Re: [xml] xmlNewNs question



On Tue, Nov 14, 2006 at 10:02:17AM -0600, David Hagood wrote:
I am defining an XML grammar for a project of mine, and I'd like to put it
into a namespace so as to avoid collisions.

As I read it, xmlNewNs needs an xmlNodePtr to create the namespace within.
The online information leaves me a bit fuzzy on what that node should be -
should that be the root node of the document, the document node itself, or
the element node?

  The namespace can only be used in the subtree of the element where it is
declared.

If I create a xmlNsPtr for a node, and then the node is destroyed, is the
xmlNsPtr still valid

  No. You must be careful when destroying an element about its subtree.

and available for other nodes? If is is invalid, does
it need to be freed?

  Invalid in an XML context has a very precise meaning related to DTD
validation, I don't see what you mean here.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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