Classes

Class XmlNode() Foundation

Class function of the XmlNode class.

Description

Instances of the XmlNode class represent nodes in XML documents. XmlNode objects provide interfaces for navigating the node hierarchy in the XML document, for manipulating attributes and content, as well as for adding or removing nodes, and for serializing XML documents.

XmlNode objects are created implicitly by the XmlSimpleParser() function while parsing an XML document.

XmlNode objects can also be created explicitly using class methods such as :createComment(), :createDocument() or :createElement(). This approach in conjunction with the :addChild()method allows the comfortable programmatic construction of complex XML documents, which subsequently can be serialized to a character string using the :toXML() method.

Creating Nodes
:createCData()
Creates a CDATA node.
:createComment()
Creates a comment node.
:createDocument()
Creates a document node representing an XML document.
:createElement()
Creates an element node.
Testing Node Types
:isCData()
Determines whether the node is a CDATA node.
:isComment()
Determines whether the node is a comment node.
:isDocument()
Determines whether the node is the document node.
:isElement()
Determines whether the node is an element node.
Document Properties
:getEncoding()
Gets the character encoding of the XML document.
:getStandalone()
Determines whether the XML document is declared as standalone.
:getVersion()
Returns the XML standard version the XML document conforms to.
:setEncoding()
Sets the character encoding of the XML document.
:setStandalone()
Specifies whether the XML document is declared as standalone.
:setVersion()
Sets the XML standard version the XML document conforms to.
Relationship
:addChild()
Adds a child node.
:addElement()
Creates an element node and adds it as a child node.
:getChild()
Gets a child node by name or ordinal.
:getChildCount()
Gets the number of child nodes.
:getChilds()
Gets specific or all child nodes.
:getNodes()
Gets all or a subset of subnodes.
:getParent()
Gets the parent node.
:hasChilds()
Determines whether child nodes are defined.
:hasParent()
Determines whether a parent node is defined.
:removeChild()
Removes a child node by node name, ordinal or by object reference.
:removeChilds()
Removes child nodes with a given name.
:replaceChild()
Replaces a child node with another node.
:setParent()
Sets the parent node.
Node Properties
:getLocalName()
Gets the local name.
:getName()
Gets the qualified name.
:getNamespace()
Gets the namespace.
:hasNamespace()
Checks whether node belongs to a namespace.
:setNamespace()
Sets the namespace.
Content Management
:getContent()
Gets the content.
:getRawContent()
Gets the content as raw XML data.
:hasContent()
Determines whether any content is defined.
:setContent()
Sets the content.
:setRawContent()
Sets the content using raw XML data.
Attribute Management
:addAttribute()
Adds an attribute.
:getAttribute()
Returns the value of a certain attribute.
:getAttributeCount()
Returns the number of attributes.
:getAttributeNames()
Returns the names of the attributes.
:getAttributeValues()
Returns the attribute values.
:getAttributes()
Returns the attributes.
:hasAttributes()
Determines whether any attributes are defined.
Serialization
:setDefaultIndentation()
Sets the indentation for serializing the XML document.
:toString()
Returns the XML representation for a node.
:toXML()
Returns the XML representation for the XML document or fragment.
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.