C# Class HandCoded.Xml.DOM

The DOM class contains utility functions that operate on a DOM tree, often combining several simpler operations or returning a more useful type.
Afficher le fichier Open project: formicary/fpml-toolkit-csharp Class Usage Examples

Méthodes publiques

Méthode Description
GetAttribute ( XmlElement context, string name ) : string

Gets the value of the specified attribute on the indicated context XmlElement. Note that this method returns null if the attribute is not present compared to the DOM function which returns a empty string.

GetChildElements ( XmlElement parent ) : XmlNodeList

Locates all the child elements of the given parent XmlElement and returns them in a (possibly empty) XmlNodeList.

GetElementByLocalName ( XmlElement parent, string localName ) : XmlElement

Locates the first child XmlElement of the indicated parent that matches the given local name string, ignoring prefixes and namespaces.

GetElementsByLocalName ( XmlElement parent, string localName ) : XmlNodeList

Locates all the child XmlElement instances of the indicated parent that match the given local name string, ignoring prefixes and namespaces.

GetFirstChild ( XmlElement parent ) : XmlElement

Finds the first child element of the given XmlElement skipping any intermediate non-element XmlNode instances.

GetLastChild ( XmlElement parent ) : XmlElement

Finds the last child element of the given XmlElement skipping any intermediate non-element XmlNode instances.

GetNextSibling ( XmlElement element ) : XmlElement

Finds the next sibling element of the given XmlElement skipping any intermediate non-element XmlNode instances.

GetParent ( XmlElement element ) : XmlElement

Finds the parent XmlElement of the given node.

GetPreviousSibling ( XmlElement element ) : XmlElement

Finds the previous sibling element of the given XmlElement skipping any intermediate non-element XmlNode instances.

HasChildNodes ( XmlElement element ) : bool

Determines if the given XmlElement has at least one child element.

SetAttribute ( XmlElement context, string name, string value ) : void

Sets the value of specified attribute on the indicated context XmlElement. If the value is null then the attribute is removed.

Private Methods

Méthode Description
DOM ( ) : System

Ensures no instances can be constructed.

Method Details

GetAttribute() public static méthode

Gets the value of the specified attribute on the indicated context XmlElement. Note that this method returns null if the attribute is not present compared to the DOM function which returns a empty string.
public static GetAttribute ( XmlElement context, string name ) : string
context System.Xml.XmlElement The context .
name string The attribute name.
Résultat string

GetChildElements() public static méthode

Locates all the child elements of the given parent XmlElement and returns them in a (possibly empty) XmlNodeList.
public static GetChildElements ( XmlElement parent ) : XmlNodeList
parent System.Xml.XmlElement The parent .
Résultat System.Xml.XmlNodeList

GetElementByLocalName() public static méthode

Locates the first child XmlElement of the indicated parent that matches the given local name string, ignoring prefixes and namespaces.
public static GetElementByLocalName ( XmlElement parent, string localName ) : XmlElement
parent System.Xml.XmlElement The parent .
localName string The required element local name string.
Résultat System.Xml.XmlElement

GetElementsByLocalName() public static méthode

Locates all the child XmlElement instances of the indicated parent that match the given local name string, ignoring prefixes and namespaces.
public static GetElementsByLocalName ( XmlElement parent, string localName ) : XmlNodeList
parent System.Xml.XmlElement The parent .
localName string The required element local name string.
Résultat System.Xml.XmlNodeList

GetFirstChild() public static méthode

Finds the first child element of the given XmlElement skipping any intermediate non-element XmlNode instances.
public static GetFirstChild ( XmlElement parent ) : XmlElement
parent System.Xml.XmlElement The parent .
Résultat System.Xml.XmlElement

GetLastChild() public static méthode

Finds the last child element of the given XmlElement skipping any intermediate non-element XmlNode instances.
public static GetLastChild ( XmlElement parent ) : XmlElement
parent System.Xml.XmlElement The parent .
Résultat System.Xml.XmlElement

GetNextSibling() public static méthode

Finds the next sibling element of the given XmlElement skipping any intermediate non-element XmlNode instances.
public static GetNextSibling ( XmlElement element ) : XmlElement
element System.Xml.XmlElement The context .
Résultat System.Xml.XmlElement

GetParent() public static méthode

Finds the parent XmlElement of the given node.
public static GetParent ( XmlElement element ) : XmlElement
element System.Xml.XmlElement The context .
Résultat System.Xml.XmlElement

GetPreviousSibling() public static méthode

Finds the previous sibling element of the given XmlElement skipping any intermediate non-element XmlNode instances.
public static GetPreviousSibling ( XmlElement element ) : XmlElement
element System.Xml.XmlElement The context .
Résultat System.Xml.XmlElement

HasChildNodes() public static méthode

Determines if the given XmlElement has at least one child element.
public static HasChildNodes ( XmlElement element ) : bool
element System.Xml.XmlElement The context .
Résultat bool

SetAttribute() public static méthode

Sets the value of specified attribute on the indicated context XmlElement. If the value is null then the attribute is removed.
public static SetAttribute ( XmlElement context, string name, string value ) : void
context System.Xml.XmlElement The context .
name string The attribute name.
value string The new value or null.
Résultat void