Anybody know about pulldom in PyXML?

Bill Xu bill.xu at newlix.com
Wed Feb 14 09:43:02 EST 2001


Hi, Gang:

Will u please tell me how to use the pulldom.startElement() in the Python
XML DOM (PyXml 0.6.3, Python 1.5, Redhat Linux 6.2) ?
 Following is my simple test program and result.
 Will u please tell me how to correct this bug?
"AttributeError: 'None' object has no attribute 'createElement'";

Thanks in advance!

Bill

=====================================================
#!/usr/bin/python
#

import os, sys, string, StringIO
import xml.dom
from xml.dom import minidom
from xml.dom.pulldom import PullDOM
import traceback



# Save the new message
def test_meth():
  print "Am i here"
  builder = PullDOM()
  builder.startElement("SET", {"PATH" : "a path"})
  builder.endElement("SET")
  print "Am i here"
  confirm(builder)
 #result = self.Print(builder)

def confirm(test, testname = "Test"):
    if test:
        print "Passed " + testname
    else:
        print "Failed " + testname
        raise Exception

print "? am i herer"
test_meth()

=======================================================
Output:

? am i herer
Am i here
Traceback (innermost last):
  File "./testdom.py", line 34, in ?
    test_meth()
  File "./testdom.py", line 20, in test_meth
    builder.startElement("SET", {"PATH" : "a path"})
  File "/usr/lib/python1.5/site-packages/xml/dom/pulldom.py", line 85, in
startElement
    node = self.document.createElement(name)
AttributeError: 'None' object has no attribute 'createElement'







More information about the Python-list mailing list