[XML-SIG] pyxml fails in mod_python-2.7.8

Tobias Hintze th@hbsn.de
Thu, 12 Dec 2002 16:51:45 +0100

On Thu, Dec 12, 2002 at 07:50:02AM -0700, Uche Ogbuji wrote:
> I'm not sure what is going on here, but unless you have to use 4DOM, I would 
> recommend using minidom (much faster).

that's what i did before.
>                 doc = minidom.parse("<foo><bar>spam</bar></foo>")

(but i use parseString() as parse seems to be for files)
> And update the initializer accordingly.
> In any case, we'll need more data to help debug.

see updated test case below. what data should i send to help debug?

current test case:
from xml.dom import minidom
from mod_python import apache

class Handler:
        def __init__(self, req):

        def dispatch(self, req):
                req.content_type = "text/plain"

                req.write("minidom test\n\n")

                doc = minidom.parseString("<foo><bar>spam</bar></foo>")
                req.write("\nparsed document: %s\n" % str(doc))

                return apache.OK

minidom test

Mod_python error: "PythonHandler handler::Handler.dispatch"

Traceback (most recent call last):

  File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 193, in Dispatch
    result = object(req)

  File "/opt/w3/default/xmltest/handler.py", line 19, in dispatch
    doc = minidom.parseString("<foo><bar>spam</bar></foo>")

  File "/usr/lib/python2.2/site-packages/_xmlplus/dom/minidom.py", line 1605, in parseString
    return expatbuilder.parseString(string)

  File "/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py", line 943, in parseString
    return builder.parseString(string)

  File "/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py", line 189, in parseString
    parser.Parse(string, True)

  File "/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py", line 231, in character_data_handler_cdata
    childNodes = self.curNode.childNodes

AttributeError: ExpatBuilderNS instance has no attribute 'curNode'

using minidom "parseString" raises exception which doesn't happen without mod_python.

Tobias Hintze http://hbs-solutions.de
HBS solutions GbR - Network & Information Systems