Can I add 700 children nodes into a
parent node ?
For example :
<points>
<point>
<point>
<points>
I want to add 700 children nodes named
"point" into the "points" node, but
my C program shows that :
xmlStaticCopyNode : malloc
failed
How can I fix this
problem?
Following is my C program
:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
xmlNodePtr
gNode;
// globle variable
int GetNode(xmlNodePtr cur, char
*TagName)
// walk through the tree
{ xmlNodePtr child; switch (cur->type) { case XML_ELEMENT_NODE: { child = cur->xmlChildrenNode; while (child != NULL) { GetNode(child, TagName); if (!xmlStrcmp(child->name, (const xmlChar *)TagName)) { gNode = child; return(1); } child = child->next; } } defalt: { return(0); break; } } } void
main(void)
// main function
{
for (j = 0; j < 700;
j++) // add 700 children
nodes
{ if (j == 0) { Write To The Node; } else { GetNode(RootEle, "point"); TempNode = xmlCopyNodeList(gNode); Write To The Node; GetNode(RootEle, "points"); parent = gNode; xmlAddChild(parent, TempNode); } } }
|