[XML-SIG] Re: does xml.dom.minidom support DTD validation?
James Kew
james.kew at gmail.com
Wed Mar 23 00:40:04 CET 2005
"Greg Wilson" <gvwilson at cs.utoronto.ca> wrote in message
news:d1ndrs$kd1$1 at sea.gmane.org...
> Title says it all --- is there a way to get xml.dom.minidom to validate a
> document against a DTD?
Maybe, depending on what "document" means here. If you have PyXML installed,
you can use its validating parser to feed minidom:
import xml.sax.sax2exts
import xml.sax.handler
parser = xml.sax.sax2exts.XMLValParserFactory.make_parser()
doc = xml.dom.minidom.parse(filename, parser=parser)
Validation errors get raised as xml.sax.SaxParseException, or you can set an
error handler using parser.SetErrorHandler.
> Or against a Relax:NG schema?
Not that I know of.
James
More information about the XML-SIG
mailing list