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

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.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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