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.
ファイルを表示 Open project: formicary/fpml-toolkit-csharp Class Usage Examples

Public Methods

Method 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

Method Description
DOM ( ) : System

Ensures no instances can be constructed.

Method Details

GetAttribute() public static method

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.
return string

GetChildElements() public static method

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 .
return System.Xml.XmlNodeList

GetElementByLocalName() public static method

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.
return System.Xml.XmlElement

GetElementsByLocalName() public static method

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.
return System.Xml.XmlNodeList

GetFirstChild() public static method

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 .
return System.Xml.XmlElement

GetLastChild() public static method

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 .
return System.Xml.XmlElement

GetNextSibling() public static method

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 .
return System.Xml.XmlElement

GetParent() public static method

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

GetPreviousSibling() public static method

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 .
return System.Xml.XmlElement

HasChildNodes() public static method

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

SetAttribute() public static method

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.
return void