new XmlObject(node)
Basic XML object that handles data connection to the DON node tree
Parameters:
| Name | Type | Description |
|---|---|---|
node |
DOM tree node |
- Source:
Methods
accept(visitor)
Methods to hook in converters that can use this XML type for formatting
Parameters:
| Name | Type | Description |
|---|---|---|
visitor |
Visitor | that converts XML to other formats |
- Source:
childExists(name) → {bool}
childExists - Check if a child exists
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Source:
Returns:
true if child exists, false otherwise
- Type
- bool
getAttribute(name) → {string}
getAttribute - Gets a string representation of an attribute
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Attribute name |
- Source:
Returns:
Attribute value
- Type
- string
getChild(name) → {DOMNode}
getChild - Gets a (usally the first) child by its tag name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Source:
Returns:
DOM node representation of the child
- Type
- DOMNode
getChildren(name) → {DOMNodeList}
getChildren - Gets all children by its tag name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child. If empty all children will be given |
- Source:
Returns:
DOM node list representation of the children
- Type
- DOMNodeList
getNum(name) → {float}
getNum - Get the numeric representation of the node. Will return NaN if failed
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Source:
Returns:
Value of the node
- Type
- float
getSiblings(name) → {DOMNodeList}
getSiblings - Gets all siblings by its tag name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the sibling. |
- Source:
Returns:
DOM node list representation of the children
- Type
- DOMNodeList
getText(name) → {string}
getText - Get the string representation of a node's text content
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Source:
Returns:
string of the text content
- Type
- string
getTextArray(name) → {Arrray}
getTextArray - Get the strings of the given child tags as array instead of string
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Source:
Returns:
string array of the text content
- Type
- Arrray
isFirst()
Check if this element is the first in the tag
- Source: