[xml] Python bindings: creating elements with namespace
- From: Frans Englich <frans englich telia com>
- To: xml gnome org
- Subject: [xml] Python bindings: creating elements with namespace
- Date: Sat, 15 Jan 2005 18:00:33 +0000
Hello,
I have trouble with simple element creation with libxml2 via the Python
bindings. I suspect that it is my Python-bindings setup. An example is
demonstrative:
doc = libxml2.newDoc( "1.0" )
top = doc.newChild( "http://www.example.com/namespace", "documentNode",
None )
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.4/site-packages/libxml2.py", line 3120, in
newChild
else: ns__o = ns._o
AttributeError: 'str' object has no attribute '_o'
top = doc.newChild( None, "documentNode", None )
top.setNs( "http://www.example.com/namespace" )
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.4/site-packages/libxml2.py", line 3302, in setNs
else: ns__o = ns._o
AttributeError: 'str' object has no attribute '_o'
Same result is achieved with newDocNode.
I installed libxml2(2.6.16) from sources; "./configure && make && make
install && python python/setup.py build install", basically.
Apart from that error, the bindings works fine(use XPath, parse documents).
Am I using the API correctly? My intent is simply to create a document
containing a document element with a default namespace. Any ideas?
Cheers,
Frans
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]