Node object
The Node object represents an XML element.
| Operation | Description |
|---|---|
| node[index] | Get a child node by its index |
| each(Node) | Iterator over child nodes |
| #Node length operator | Gets the number of child nodes |
| tostring(Node) | Gets the string representation of the node |
| Property | Description | Access | Type |
|---|---|---|---|
| Node.attributes | Get/set attributes of the node | readonly | table |
| Node.isleaf | Checks if the node has no children | readonly | boolean |
| Node.name | Get/set the name of the node | readwrite | string |
| Node.parent | Get/set the parent node | readwrite | |
| Node.text | Get/set the text content of the node | readwrite | string |
| Methods | Description | Return value |
|---|---|---|
| Node:constructor() | Creates a new Node object instance | |
| Node:add() | Add a child node to the current node | |
| Node:clone() | Create a deep copy of the node to a new one. | |
| Node:query() | Find a node using a Path expression | table nil |
| Node:remove() | Remove the current node from its parent | boolean |