Re: [xml-bindings]Minor bug in python bindings tree stuff
- From: Daniel Veillard <veillard redhat com>
- To: Pete Ryland <peter_ryland reech com>
- Cc: xml-bindings gnome org
- Subject: Re: [xml-bindings]Minor bug in python bindings tree stuff
- Date: Tue, 19 Mar 2002 15:03:57 -0500
On Tue, Mar 19, 2002 at 07:11:27PM +0000, Pete Ryland wrote:
> Hi there,
>
> I hope this is the right forum to post this too.
That's the right place, though the Gnome bugzilla might be even better
http://xmlsoft.org/bugs.html
> The docSetRootElement() function in the python bindings is wrong (IMO)
> on two counts. Firstly, it should be a method of doc rather than node,
Right,
> and secondly it will raise an exception when the C function
> xmlDocSetRootElement() returns null which will happen under non-error
> conditions since it "Returns : the old root element if any was found"
> and this could well be null.
Hum, right too.
The bindings are automatically generated, and only a few functions
requires special treatment. xmlDocSetRootElement() is one of them.
> This makes it quite hard to create a document from scratch in python. A
> workaround goes something like this:
>
> doc = libxml2.newDoc('1.0')
> rootNode = doc.newDocNode(None, 'myrootnode', None)
> # rootNode.docSetRootElement(doc)
> libxml2mod.xmlDocSetRootElement(doc._o, rootNode._o)
> ...
You can still do
doc.addChild(rootNode)
This should work too. I realize that there is no example of building
document in http://xmlsoft.org/python.html , that's missing.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
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]