pyXML exceptions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Odd Bjornstad

    pyXML exceptions

    Hello



    Am parsing xml with pyXML and using the following code:



    from xml.parsers.xml proc import xmlproc

    from xml.parsers.xml proc import xmlval

    from xml.parsers.xml proc import xmldtd



    ..

    ..





    def parser(xml,dtd) :

    print 'Start XML Parsing'

    d = xmldtd.load_dtd (dtd)

    p = xmlval.XMLValid ator()

    p.set_applicati on(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


Working...