axl.Node class represents a single node instance that is hold by a document (axl.Doc).
The usual operation is to load a document and the acquire a reference to the node inside as follows:
# load the document
(doc, err) = axl.parse ("<root-node><child /></root-node>")
if err:
print ("Failed to parse content: " + err.msg)
return -1
# get the <child> node
node = doc.get ("/root-node/child")
However, you can also create new nodes using the type constructor of axl.Node as follows:
# set a new root node
doc.root = axl.Node ("test")
Allows to get the next node on the same level or the instance node, but with the provide name.
| Parameters: | node_name (String) – node name to match. |
|---|---|
| Return type: | Returns an instance of axl.Node or None if no node was found. |
Allows to get the previous node on the same level or the instance node, but with the provide name.
| Parameters: | node_name (String) – node name to match. |
|---|---|
| Return type: | Returns an instance of axl.Node or None if no node was found. |
Allows to get the first node child, but with the provide name.
| Parameters: | node_name (String) – node name to match. |
|---|---|
| Return type: | Returns an instance of axl.Node or None if no node was found. |
Gets the xml child node called as provided. The child is looked up in all childs found starting the parent node.
| Parameters: | node_name (String) – node name to match. |
|---|---|
| Return type: | Returns an instance of axl.Node or None if no node was found. |
Allows to get a reference to the child node located at the same level at the nth position.
| Parameters: | position (Integer) – node position. |
|---|---|
| Return type: | Returns an instance of axl.Node or None if no node was found. |
Allows to check if the provided node has the given attribute.
| Parameters: |
|
|---|---|
| Return type: | Returns the presence of the provided attribute on the given node, and optionall checking if that attribute has a particular value. |
Allows to get the value associated to the attribute (attr_name) or to configure the provided value if two arguments are provided.
| Parameters: |
|
|---|---|
| Return type: | Returns a string if only one parameter is provided representing the attribute value or None if attribute and value are provided. |
Gets the attribute content for the provided attribute name, at the provided node, but translating entity references found.
| Parameters: | attr_name (String) – the attribute name to get its value. |
|---|---|
| Return type: | Returns a string or None representing the attribute value. |
Allows to configure a new child node.
| Parameters: | node (axl.Node) – the new child node to configure. |
|---|
Allows to configure a new child node placing it after the calling node inside the same level. Both nodes will share parent node. Node must be not attached to a document. See deattach() to disconnect a node from a document or create a new node (axl.Node).
| Parameters: | node (axl.Node) – the new child node to configure. |
|---|
Creates a new axl.AttrCursor instance which is used to perform efficient node attribute iteration. See axl_node_attr_cursor_new.
| Parameters: | node (axl.Node) – the new child node to configure. |
|---|
Allows to remove the node from its current document. By default the internal node is deallocated.
| Parameters: | node (axl.Node) – the new node to be removed from current holding document |
|---|
Allows to remove the node from its current document. By default the internal node is deallocated.
| Parameters: | node (axl.Node) – the new node to be removed from current holding document |
|---|
Allows to disconnect the node from its current document.
Allows to clear all content set inside a particular node.
(Read only attribute) (String) Allows to get the node name.
(Read/Write attribute) (axl.Node) Allows to get/set the node content. See axl_node_get_content and axl_node_set_content from C API. The attribute detects on write operations if the content to be configured is not supported directly without replacing &, <, ‘, >, ”, and ;. In such case, Axl API translate the content (replacing those values by &, <, etc...).
The attribute returns a tuple with (content, size).