0

I use mxml library to parse XML file in C language. I load my XML in buffer using the following code:

mxml_node_t *tree; 
tree = mxmlLoadString(NULL,XMLbuf,MXML_OPAQUE_CALLBACK);

The XML file is complicated but this is irrelevant at the moment.

My question is : when I should free memory used by the mxml library functions?

Is it enough to use code like this once and for all:

mxmlDelete(tree);

or I have to repeat that for every node of my XML.(mxmlDelete(node1);mxmlDelete(node2); until I reach mxmlDelete(tree);?

Seki
  • 11,135
  • 7
  • 46
  • 70
Lambov
  • 15
  • 1
  • 6

1 Answers1

0

The documentation clearly states the answer:

Delete a node and all of its children.

So if you call this on a top-level node (the tree's root), you should be done.

unwind
  • 391,730
  • 64
  • 469
  • 606
  • Yes ,node and all of its children but what about "next" node? I am not sure if one call of mxmlDalete(tree) free all "children" and "next" nodes or only tree's "children" nodes – Lambov May 30 '12 at 12:46