Hey,

I'm trying to figure out how I can validate an XML file using a DTD that isn't specified in the XML file.

My code so far is:

from xml import sax
from xml.sax import sax2exts

parser = sax2exts.XMLValParserFactory.make_parser()

parser.setContentHandler(handler)
parser.setErrorHandler(handler)

parser.parse(xml_file)

And this works fine if the DTD is specified in the XML file i.e errors are generated for non-compliant entities. But I would like to force the file to be valid according to one other DTD file that is not referenced in the XML file.

Anyone know how to do this?

Cheers,
Brian
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to