XML node manipulation.
More...
◆ GetAttributeNames
Get all attribute names of this node.
The caller is responsible for freeing the returned string array.
- Parameters
-
| node | This XML node object. |
- Returns
- A string array containing all attribute names.
◆ GetAttribute
Get the value of an attribute by key.
The caller is responsible for freeing the returned string.
- Parameters
-
| node | This XML node object. |
| key | The attribute key. |
- Returns
- The value of the attribute as a string, or NULL if not found.
◆ SetAttribute
| void(* CMUTIL_XmlNode::SetAttribute) (CMUTIL_XmlNode *node, const char *key, const char *value) |
Set the value of an attribute by key.
- Parameters
-
| node | This XML node object. |
| key | The attribute key. |
| value | The value to set for the attribute. |
◆ ChildCount
Get the number of child nodes.
- Parameters
-
| node | This XML node object. |
- Returns
- The number of child nodes.
◆ AddChild
Add a child node to this node.
The ownership of the child node is transferred to this node.
- Parameters
-
| node | This XML node object. |
| child | The child node to add. |
◆ ChildAt
Get the child node at a specific index.
The caller is responsible for not modifying or destroying the returned child node.
- Parameters
-
| node | This XML node object. |
| index | The index of the child node to retrieve. |
- Returns
- The child node at the specified index, or NULL if index is out of bounds.
◆ GetParent
Get the parent node of this node.
The caller is responsible for not modifying or destroying the returned parent node.
- Parameters
-
| node | This XML node object. |
- Returns
- The parent node, or NULL if this node has no parent.
◆ GetName
Get the name of this node.
For a text node the "name" is the text itself.
- Parameters
-
| node | This XML node object. |
- Returns
- The name of the node as a C-style string. It belongs to the node.
◆ SetName
| void(* CMUTIL_XmlNode::SetName) (CMUTIL_XmlNode *node, const char *name) |
Set the name of this node.
- Parameters
-
| node | This XML node object. |
| name | The new name for the node. |
◆ GetType
Get the text content of this node.
The caller is responsible for freeing the returned string.
- Parameters
-
| node | This XML node object. |
- Returns
- The text content of the node as a string.
◆ ToDocument
Convert this node and its children to an XML document string.
The caller is responsible for freeing the returned string.
- Parameters
-
| node | This XML node object. |
| beutify | Whether to format the output string for readability. |
- Returns
- The XML document string representation of this node.
◆ SetUserData
| void(* CMUTIL_XmlNode::SetUserData) (CMUTIL_XmlNode *node, void *udata, void(*freef)(void *)) |
Set user data associated with this node.
The user data can be any pointer type. A callback function can be provided to free the user data when the node is destroyed.
- Parameters
-
| node | This XML node object. |
| udata | The user data to associate with this node. |
| freef | A callback function to free the user data when no longer needed. |
◆ GetUserData
Get the user data associated with this node.
- Parameters
-
| node | This XML node object. |
- Returns
- The user data associated with this node.
◆ Destroy
Destroy this XML node and free its resources.
- Parameters
-
| node | This XML node object. |
The documentation for this struct was generated from the following file: