Re: [xml] Building a DOM tree in python using libxml2

William M. Brack said:
Colin Fox said:

It'd be nice actually if _obj was None that the appropriate
got made to manufacture it.


I'm not quite convinced of that - and I'm not certain, but it looks
as if you have a small misunderstanding of the Python bindings.  As
mentioned in the docs, "most of the
bindings are automatically generated, and the xml prefix is removed
and the casing convention are kept".  In other words, libxml2.xmlDoc
is *not* the proper way to create a document, and libxml2.xmlNode is
*not* for creating a node in the tree.  They are, in fact, *classes*
to implement the various methods (the proper methods are
libxml2.newDoc and the newChild method of the resulting document
object, as mentioned in John Fleck's email).

I'm still looking at how to cleanly check what object the user
provides (in order to prevent a segfault), but I work slowly when a
lot of stuff I never knew about before is involved :-).


After further discussion with Daniel (off-list), it was agreed that
the "manufacturing" of such items would be useful.  I'm afraid that
might take me even longer to implement - in the meantime, I have put
in a (temporary?) check to make the code complain if an incorrect
usage (such as your original posting) is attempted.  That change is
in CVS, and hopefully this will prevent the segfault.


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