Re: [xml] xmlNewNs question

On Tue, Nov 14, 2006 at 11:11:25AM -0600, David Hagood wrote:
On Tue, Nov 14, 2006 at 10:02:17AM -0600, David Hagood wrote:
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.

It refers to the previous question - if the xmlNodePtr for which the
xmlNsPtr is created is destroyed, does the xmlNsPtr need to be freed, or
is it implicitly freed when the xmlNodePtr is freed.

 How do you destroy it ? Asking the question is likely to bring back an
unambiguous answer. The function to do this is:
and its description clearly tells it's recursive and free all children.
Namespace declarations are children. Now if you move stuff around it really
depends what you do.


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]