[xml] Difference btw. xmlNewDocNode and xmlNewNode



Greetings!

I'm really a bit confused about xmlNewDocNode() vs. xmlDocNode() ...
Can anyone explain to me what's the difference in using these two (or point
me to where that kindo of basics would be explained)?

xmlNodePtr xmlNewNode (xmlNsPtr ns, const xmlChar * name)
Vs.
xmlNodePtr xmlNewDocNode (xmlDocPtr doc, xmlNsPtr ns, const xmlChar * name,
const xmlChar * content)

{
doc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION);
root_element = xmlNewDocNode(doc, NULL, BAD_CAST "EXAMPLE", NULL);
xmlDocSetRootElement(doc, root_element);
...
xmlFreeDoc(doc);
}
Vs.
{
doc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION);
root_element = xmlNewNode(NULL, BAD_CAST "EXAMPLE");
xmlDocSetRootElement(doc, root_element);
...
xmlFreeDoc(doc);
}

-> ?

Thank you!


best regards / mit freundlichen Grüßen,
Martin Trappel
-------------------------------------------------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]