ignoring dtd file in sax parser

Martin v. Löwis loewis at informatik.hu-berlin.de
Thu Sep 12 06:14:04 EDT 2002


amichail at cse.unsw.edu.au (Amir Michail) writes:

> I tried:
> 
>         parser.setFeature(feature_namespaces, 0)
>         parser.setFeature(feature_validation, 0)
> 
>         parser.setContentHandler(ph)
> 
>         try:
>             parser.parse(f)
>     #        print "NO PARSE ERRORS"
>         except xml.sax._exceptions.SAXParseException:
>             print "XML parse errors in " + fn
> 
> 
> However, it still complains about not finding the dtd file.

You need to install an EntityResolver in the parser; that resolver can
then return an empty resource.

Regards,
Martin




More information about the Python-list mailing list