|
Dan Olsen
python at dan-olsen.net
Wed Jun 23 17:42:33 EDT 2004
I was wondering if anyone could help me figure out how to do some xml
parsing with mod_python. The code I have is:
#####################################
from mod_python import apache
import xml.dom.minidom
import urllib
def crazy(req, url):
sock = urllib.urlopen( url )
indata = sock.read()
sock.close()
dom = parse(indata)
return "<html>PASS</html>"
#####################################
The output that I get when I try to run the script in my browser is:
#####################################
Mod_python error: "PythonHandler mod_python.publisher"
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 193,
in Dispatch
result = object(req)
File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line
171, in handler
result = apply(object, (), args)
File "/web/htdocs/python/rose.py", line 9, in crazy
File "/usr/lib/python2.3/site-packages/_xmlplus/dom/minidom.py", line
1908, in parse
return expatbuilder.parse(file)
AttributeError: 'module' object has no attribute 'parse'
######################################
Can anyone help me figure out what I am doing wrong? I have tried
tweaking the code a little bit but with no luck. Is there some
documentation out there that I can read about mod_python and parsing XML?
-- Dan Olsen
|