ignoring dtd file in sax parser

Amir Michail amichail at cse.unsw.edu.au
Thu Sep 12 02:51:23 EDT 2002


Hi,

I'm trying to parse XML files that specify
a dtd.  However, I would like to ignore the dtd,
and in fact, the dtd file is not even present.

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.

Amir



More information about the Python-list mailing list