O
Odd Bjornstad
Hello
Am parsing xml with pyXML and using the following code:
from xml.parsers.xmlproc import xmlproc
from xml.parsers.xmlproc import xmlval
from xml.parsers.xmlproc import xmldtd
..
..
def parser(xml,dtd):
print 'Start XML Parsing'
d = xmldtd.load_dtd(dtd)
p = xmlval.XMLValidator()
p.set_application(MyApp())
p.feed(xml)
#-à here I want to get some form of control over the messages (if syntax/
other error) that the parser print into console
print 'End XML Parsing'
..
..
..
I need to catch the messages thrown by the parser when there are syntax
errors in the XML or DTD.
These messages seems to be exceptions but it's a bit confusing not being
able to catch them.
Now I only get messages printed in the console but I want to put the
messages into a logfile or database table.
Any suggestions ?
Regards
Odd Bjørnstad
Am parsing xml with pyXML and using the following code:
from xml.parsers.xmlproc import xmlproc
from xml.parsers.xmlproc import xmlval
from xml.parsers.xmlproc import xmldtd
..
..
def parser(xml,dtd):
print 'Start XML Parsing'
d = xmldtd.load_dtd(dtd)
p = xmlval.XMLValidator()
p.set_application(MyApp())
p.feed(xml)
#-à here I want to get some form of control over the messages (if syntax/
other error) that the parser print into console
print 'End XML Parsing'
..
..
..
I need to catch the messages thrown by the parser when there are syntax
errors in the XML or DTD.
These messages seems to be exceptions but it's a bit confusing not being
able to catch them.
Now I only get messages printed in the console but I want to put the
messages into a logfile or database table.
Any suggestions ?
Regards
Odd Bjørnstad