call to 'newNs(...)'

[email protected] Mon, 19 Aug 2002 16:20:42 +0200
Newsgroups gmane.comp.gnome.lib.xml.bindings
Message-ID <20020819142042.GA20515@www>
Hello list,

i've encountered a strange problem with the 
libxml2 python bindings.
While the following works:

 doc = libxml2.newDoc("1.0")
 root = doc.newChild(None, "doc", None)
 root.newNs("http://example.com/doc", "my")
 
this doesn't:

 doc = libxml2.parseFile("example.xml")
 root=doc.children
 root.newNs("http://example.com/doc", "my")

The error message reads as follows:

Traceback (most recent call last):
  File "test.py", line 12, in ?
    root.newNs("http://example.com/doc", "my")
  File "/usr/local/lib/python2.1/site-packages/libxml2.py", line 1452, in newNs
    if ret == None:raise treeError('xmlNewNs() failed')
libxml2.treeError: xmlNewNs() failed


What am i missing ?

  Ralf Mattes