List Info

Thread: Difference btw. xmlNewDocNode and xmlNewNode




Difference btw. xmlNewDocNode and xmlNewNode
country flaguser name
Austria
2007-03-30 05:52:11
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
------------------------------------------------------------
-------------
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

Re: Difference btw. xmlNewDocNode and xmlNewNode
user name
2007-03-30 07:36:53
On Fri, Mar 30, 2007 at 12:52:11PM +0200, Trappel Martin
wrote:
> 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)

  xmlNewNode allows to build a node outside of any document
context
  xmlNewDocNode also allow to initialize a text node child
with the given
                content if given

Daniel

-- 
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )