DOM

Jesper Holmberg jesper at strindberg.maisel.enst-bretagne.fr
Sun Dec 9 06:00:17 EST 2001


This code works fine in the python (2.1.1) interpreter:

  from xml.dom import minidom

  myDoc = minidom.Document()
  myEl = myDoc.createElement('jeppe')
  myEl2 = myDoc.createElement('henning')
  myDoc.appendChild(myEl)
  myDoc.insertBefore(myEl2, myEl)
  print myEl2.parentNode
  print myEl2.nextSibling


However, when I put this code in a Zope (2.4.2) product, and run it, I get an
error on the last line:

  Error Type: AttributeError
  Error Value: nextSibling

with trace ending in:

  File /usr/lib/zope/lib/python/xml/dom/minidom.py, line 74, in __getattr__
  AttributeError: (see above)


So for some reason, the node myEl2 is not correctly inserted in the DOM.
It knows its parent, but not who is it's sibling. In fact, if nextSibling
were None, there wouldn't be an error, but now it doesn't even know it has
an attribute with this name.

Does anyone have an idea what could be the problem?

TIA,

Jesper



More information about the Python-list mailing list