[xml-bindings]call to 'newNs(...)'



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



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