Every piece of information in an XML file (elements, text, numbers) is stored in memory in "nodes". Nodes are defined by the mxml_node_t structure. The type member defines the node type (element, integer, opaque, real, or text) which determines which value you want to look at in the value union.
New nodes can be created using the mxmlNewElement(), mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), and mxmlNewText() functions. Only elements can have child nodes, and the top node must be an element, usually "?xml".
Each node has pointers for the node above (parent), below ( child), to the left (prev), and to the right (next ) of the current node. If you have an XML file like the following:
<?xml version="1.0"?> <data> <node>val1</node> <node>val2</node> <node>val3</node> <group> <node>val4</node> <node>val5</node> <node>val6</node> </group> <node>val7</node> <node>val8</node> <node>val9</node> </data>
the node tree returned by mxmlLoadFile() would look like the following in memory:
?xml | data | node - node - node - group - node - node - node | | | | | | | val1 val2 val3 | val7 val8 val9 | node - node - node | | | val4 val5 val6
where "-" is a pointer to the next node and "|" is a pointer to the first child node.
Once you are done with the XML data, use the mxmlDelete() function to recursively free the memory that is used for a particular node or the entire tree:
mxmlDelete(tree);