Re: [xml] Namespace declaration parent, doc: also broken?



On Sun, Feb 08, 2004 at 12:18:26PM +0800, William M. Brack wrote:
Perhaps you could elaborate?

I can see from the C documentation link you provided that the parent
and document references aren't available. I was mislead by the Python
binding's class structure where xmlNode is a superclass of xmlNs.

As for the philosophical point, I can get the parent of an attribute,
so why not a namespace declaration? Both are defined on a particular
element, right?

For my code, the practical issue boils down to memory managment. As
you probably know, Python's gc doesn't extend to libxml2
nodes. Sometimes I would like a function to return a lone namespace
declaration (or an attribute, an element, etc.). This requires
creating a temporary document to hold it. I wish the client could
always use the node itself to access the temporary document to free
it, but I guess a special case is currently necessary for xmlNs.

The application is a functional xml library for Python which has
import/export support for libxml2 (and uses libxml2 for parsing,
serialization, RelaxNG, etc.). In this case, ironically, "functional"
means that the Python elements don't have parent pointers. Temporary
documents seem to be necessary for libxml2 export of any non-document
node. Hopefully that explains why I might want the document reference
to be available.

Incidentally, I am able to make that library available under an Open
Source license if anyone is interested.

Thank you very much for patching the serialization code.

--
Anthony Carrico



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