[XML-SIG] parse_resource - I can't get it to work
Andrew Maclean
andyjmaclean at hotmail.com
Wed Jan 7 08:26:00 EST 2004
Hello again,
I'm still having problems with the "parse_resource" command. I've got the
ErrorHandling interface working but it's still coming up with a fatal error.
The error handler does this:
def fatal(self,msg):
print "fatal"
"Handles a fatal error message."
if self.locator==None:
print "ERROR: "+msg
else:
print self.locator
print "ERROR: "+msg+" at %s:%d:%d" %
(self.locator.get_current_sysid(), self.locator.get_line(),
self.locator.get_column())
print "TEXT: '%s'" % (self.locator.data[self.locator.pos:
self.locator.pos+10])
In the console window for Zope I get the text:
init
fatal
<folder instance at 023870B8>
Unexpected error : exceptions.AttributeError
and the browser window shows the text:
Site Error
An error was encountered while publishing this resource.
Error Type: AttributeError
Error Value: get_current_sysid
My test XML file is completely valid, here it is in all it's glory:
<?xml version = "1.0" encoding="UTF-8"?>
<document>
hhh
</document>
...and the script I use to parse it is of the simplest kind:
file = 'C:/Andy/XSL/test.xml'
p = xmlproc.XMLProcessor()
p.set_application(MyApp())
p.set_error_handler(MyErrorHandler(self))
try:
p.parse_resource(file)
except IOError, (errno, strerror):
print "I/O error(%s): %s" % (errno, strerror)
except ValueError:
print "Could not convert data to an integer."
except:
print "Unexpected error:", sys.exc_info()[0]
dbFile.write("Unexpected error:" + str(sys.exc_info()[0]));
dbFile.close();
pass
raise
Can anyone please help?
_________________________________________________________________
Express yourself with cool emoticons - download MSN Messenger today!
http://www.msn.co.uk/messenger
More information about the XML-SIG
mailing list