[XML-SIG] turn off dtd check in SAX

Paul Tremblay phthenry at earthlink.net
Sat Oct 25 15:15:27 EDT 2003


Is there a way to run SAX if the dtd in the document points to a url,
and the url cannot be retrieved? I can parse my documents with SAX so
long as I am connected to the internet. But when I am not connected, I
get an error that the url cannot be found.

I could just delete the dtd, but this is kind of a hack. I am
distributing code, and I would like for the XML document which I am
parsing to have a dtd.

Here is a snippet of my code:


        parser = xml.sax.make_parser()
        parser.setFeature(feature_namespaces, 0)
        parser.setErrorHandler(ErrorHandler())
        section_handler = FormSections(
            write_obj = write_obj,
            highest_level = self.__highest_level,
            )

        parser.setContentHandler(section_handler)
        parser.parse(self.__input_file)




Thanks

Paul







More information about the XML-SIG mailing list