XMLNode
Description
XMLNode is a base class for every object that is in the XML Document Object Model (DOM), except XMLAttributes. Nodes have siblings, a parent, and children which can be navigated. A node is always in a XMLDocument. The type of a XMLNode can be queried, and it can be cast to its more defined type.
@attention Loom's XML Library is based on TinyXML 2. If you see something in TinyXML 2 that you do not see in this API, please contact The Engine Co.
API overview
Constructor
XMLNode
()
Functions
Public functions
| deleteChild ( node: XMLNode ): Void |
native Delete a child belonging to the XMLNode |
| deleteChildren (): Void |
native Delete all the children of the XMLNode |
| firstChild (): XMLNode |
native Gets the first child XMLNode |
| firstChildElement ( name: String = null ): XMLElement |
native Get the first child XMLElement, or optionally the first child element with the specified name |
| getDocument (): XMLDocument |
native Gets the XMLDocument that owns the XMLNode |
| getParent (): XMLNode |
native Gets the parent of this node in the DOM |
| getValue (): String |
native Gets the value of the XMLNode |
| insertAfterChild ( afterThis: XMLNode , addThis: XMLNode ): XMLNode |
native Add an XMLNode after the specified child node |
| insertEndChild ( addThis: XMLNode ): XMLNode |
native Add a child XMLNode as the last (right) child |
| insertFirstChild ( addThis: XMLNode ): XMLNode |
native Add a child node as the first (left) child |
| lastChild (): XMLNode |
native Gets the last child XMLNode |
| lastChildElement ( name: String = null ): XMLElement |
native Gets the last child XMLElement, or optionally the last child element with the specified name |
| linkEndChild ( addThis: XMLNode ): XMLNode | native |
| nextSibling (): XMLNode |
native Gets the next (right) sibling XMLNode of this node |
| nextSiblingElement ( name: String = null ): XMLElement |
native Gets the next (right) sibling XMLElement of this node |
| noChildren (): Boolean |
native Returns true if this node has no children |
| previousSibling (): XMLNode |
native Gets the previous (left) sibling XMLNode of this node |
| previousSiblingElement ( name: String = null ): XMLElement |
native Get the previous (left) sibling XMLElement of this node |
| setValue ( v: String , staticMem: Boolean = false ): Void |
native Sets the value of the XMLNode |
| shallowClone ( doc: XMLDocument ): XMLNode |
native Make a copy of this XMLNode, but not its children |
| shallowEqual ( compare: XMLNode ): Boolean |
native Test if 2 XMLNode%s are the same, but don't test children |
| toComment (): XMLComment |
native Safely cast to an XMLComment |
| toDeclaration (): XMLDeclaration |
native Safely cast to an XMLDeclaration |
| toDocument (): XMLDocument |
native Safely cast to an XMLDocument |
| toElement (): XMLElement |
native Safely cast to an XMLElement |
| toText (): XMLText |
native Safely cast to an XMLText |
Constructor
XMLNode ()
Functions
deleteChild ( node: XMLNode ): Void
native
Delete a child belonging to the XMLNode.
Parameters
| node: XMLNode | The XMLNode to delete. |
firstChild (): XMLNode
native
Gets the first child XMLNode.
Returns
| XMLNode | The first child XMLNode or null if none exist. |
firstChildElement ( name: String = null ): XMLElement
native
Get the first child XMLElement, or optionally the first child element with the specified name.
Parameters
| name: String = null | Optional name for finding the first child element by name. |
Returns
| XMLElement | First child XMLElement or null if none exist or if name does not match any child XMLElements. |
getDocument (): XMLDocument
native
Gets the XMLDocument that owns the XMLNode.
Returns
| XMLDocument | The owning XMLDocument. |
getFullTypeName
(): String
Inherited from Object
native
Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.
Returns
| String | fully qualified type name of the Object. |
getParent (): XMLNode
native
Gets the parent of this node in the DOM.
Returns
| XMLNode | The parent of this XMLNode or null if the XMLNode has no parent. |
getType
(): Type
Inherited from Object
native
Gets the Type that describes the Object.
Returns
| Type | The Type that describes the object. |
getTypeName
(): String
Inherited from Object
native
Gets the type name of the Object.
Returns
| String | type name of the Object. |
getValue (): String
native
Gets the value of the XMLNode. The meaning of 'value' changes based on the type.
Document: empty
Element: name of the element
Comment: the comment text
Unknown: the tag contents
Text: the text string
Returns
| String | The value of the XMLNode. |
insertAfterChild ( afterThis: XMLNode , addThis: XMLNode ): XMLNode
native
Add an XMLNode after the specified child node.
Parameters
| afterThis: XMLNode | The relative XMLNode. |
| addThis: XMLNode | The XMLNode to add. |
Returns
| XMLNode | The added XMLNode. |
insertEndChild ( addThis: XMLNode ): XMLNode
native
Add a child XMLNode as the last (right) child.
Parameters
| addThis: XMLNode | The XMLNode to add. |
Returns
| XMLNode | The added XMLNode. |
insertFirstChild ( addThis: XMLNode ): XMLNode
native
Add a child node as the first (left) child.
Parameters
| addThis: XMLNode | The XMLNode to add. |
Returns
| XMLNode | The added XMLNode. |
lastChild (): XMLNode
native
Gets the last child XMLNode.
Returns
| XMLNode | The last child XMLNode or null if none exist. |
lastChildElement ( name: String = null ): XMLElement
native
Gets the last child XMLElement, or optionally the last child element with the specified name.
Parameters
| name: String = null | Optional name for finding the last child element by name. |
Returns
| XMLElement | First child XMLElement or null if none exist or if name does not match any child XMLElements. |
nextSibling (): XMLNode
native
Gets the next (right) sibling XMLNode of this node.
Returns
| XMLNode | Next sibling XMLNode or null if none exist. |
nextSiblingElement ( name: String = null ): XMLElement
native
Gets the next (right) sibling XMLElement of this node.
Parameters
| name: String = null | Optional name for finding the next sibling element by name. |
Returns
| XMLElement | Next sibling XMLNode or null if none exist. |
previousSibling (): XMLNode
native
Gets the previous (left) sibling XMLNode of this node.
Returns
| XMLNode | Previous sibling XMLNode or null if none exist. |
previousSiblingElement ( name: String = null ): XMLElement
native
Get the previous (left) sibling XMLElement of this node.
Parameters
| name: String = null | Optional name for finding the previous sibling element by name. |
Returns
| XMLElement | Previous sibling XMLNode or null if none exist. |
setValue ( v: String , staticMem: Boolean = false ): Void
native
Sets the value of the XMLNode.
See also:
getValue
Parameters
| v: String | The value to set. |
| staticMem: Boolean = false |
shallowClone ( doc: XMLDocument ): XMLNode
native
Make a copy of this XMLNode, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this.getDocument())
@note If called on an XMLDocument, this will return null.
Parameters
| doc: XMLDocument | The owner of the new XMLNode. |
Returns
| XMLNode | Shallow copy of the XMLNode or null if called on a XMLDocument. |
shallowEqual ( compare: XMLNode ): Boolean
native
Test if 2 XMLNode%s are the same, but don't test children. The 2 nodes do not need to be in the same XMLDocument.
@note If called on an XMLDocument, this will return false.
Parameters
| compare: XMLNode | The XMLNode to compare to. |
Returns
| Boolean | Whether or not the XMLNode%s are shallow equals. |
toComment (): XMLComment
native
Safely cast to an XMLComment.
Returns
| XMLComment | The casted XMLComment or null if the cast was unsuccessful. |
toDeclaration (): XMLDeclaration
native
Safely cast to an XMLDeclaration.
Returns
| XMLDeclaration | The casted XMLDeclaration or null if the cast was unsuccessful. |
toDocument (): XMLDocument
native
Safely cast to an XMLDocument.
Returns
| XMLDocument | The casted XMLDocument or null if the cast was unsuccessful. |
toElement (): XMLElement
native
Safely cast to an XMLElement.
Returns
| XMLElement | The casted XMLElement or null if the cast was unsuccessful. |