class XmlNode
The XmlNode class represents a single node in an xml-document.
A node typically has an arbitrary name, which is used for the xml tag. Nodes can also have any number of attributes and child nodes. A special child node is the CDATA node, which is all text between the tag and it's end tag.
Methods
int AddAttribute (const string, const string) | Adds the specified attribute. |
XmlNode AddNode (const string) | Adds a new child node to this node and returns it. |
Enumerate (XmlNode::Enumerator, var) | Enumerates the node's children and calls the specified delegate for each child node. |
XmlAttrIterator GetAttrIterator () | Returns an iterator object that allows to inspect this node's attributes. |
string GetAttribute (const string) | Gets the value of the specified attribute. |
string GetCData () | Returns this node's CDATA. |
XmlNode GetNode (const string) | Gets a child node from this node by name. |
XmlNodeIterator GetNodeIterator () | Returns an iterator object that allows to inspect this node's child nodes. |
string GetText () | Gets this node's text only. |
int HasAttribute (const string) | Checks if the specified attribute is defined. |
int SetAttribute (const string, const string) | Sets the value of the specified attribute. |
Properties
string Name () | Depending on the node's type returns one of the following: Node name (kNode), Comment text (kComment), Node text (kCDATA). |
Name (const string) | Sets the node's name property. |
int Type () | Returns the node's type, which is kNode (0), kComment (1), or kCDATA (2). |
Reference
method int AddAttribute (const string name, const string value) |
Adds the specified attribute. If the attribute already exists, returns false. |
method XmlNode AddNode (const string name) |
Adds a new child node to this node and returns it. The added node will have the type kNode, it is not possible to add nodes of other types. |
method Enumerate (XmlNode::Enumerator fn, var args) |
Enumerates the node's children and calls the specified delegate for each child node. This is not a recursive operation. |
method XmlAttrIterator GetAttrIterator () |
Returns an iterator object that allows to inspect this node's attributes. |
method string GetAttribute (const string name) |
Gets the value of the specified attribute. If the attribute does not exist, returns null. |
method string GetCData () |
Returns this node's CDATA. If the node has child nodes, this will actually return them as XML. Invalid characters will be escaped using XML entities. |
method XmlNode GetNode (const string name) |
Gets a child node from this node by name. If no child node with the specified name exists, returns null. The first node with a matching name is returned. |
method XmlNodeIterator GetNodeIterator () |
Returns an iterator object that allows to inspect this node's child nodes. |
method string GetText () |
Gets this node's text only. No escaping is performed. If the node does not have any text, an empty string is returned. |
method int HasAttribute (const string name) |
Checks if the specified attribute is defined. Returns true if that is the case, otherwise false. |
method int SetAttribute (const string name, const string value) |
Sets the value of the specified attribute. If the attribute does not exist, returns false. |
accessor string Name () |
Depending on the node's type returns one of the following: Node name (kNode), Comment text (kComment), Node text (kCDATA). |
accessor Name (const string) |
Sets the node's name property. |
accessor int Type () |
Returns the node's type, which is kNode (0), kComment (1), or kCDATA (2). |