Re: [xml] xmlNewNs question



Daniel Veillard wrote:

 How do you destroy it ? Asking the question is likely to bring back an
unambiguous answer. The function to do this is:
   http://xmlsoft.org/html/libxml-tree.html#xmlFreeNode
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.


It is NOT clear from the documentation that the namespace declaration is a child of the node, as it can get passed to other node objects when they are created - so to my mind that makes it owned by multiple objects and thus not a child of any one object. This is where a simple statement in the docs for the creation function that "the created namespace object is a child of this node" would go miles to clarifying ownership.

Even better would be a statement to the effect of "the namespace object so created should ONLY be used for nodes which are children of the node for which the namespace was created."

These things may be clear to you - you work with the library all the time. They are not necessarily clear to those of us coming in to the library the first time. I learned a long time ago that when it comes to documentation, "Sometimes its the things you didn't say that get you in trouble."



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