[XML-SIG] validating xml

Lars Marius Garshol larsga@garshol.priv.no
09 Aug 2001 23:30:28 +0200


* Martin v. Loewis
| 
| The easiest solution probably is to install PyXML. That will give
| you the xmlproc parser, which is a validating parser.

To use it you must write a DTD and refer to it from your XML
document.  This should be easy.

| The easiest way to access it is either through SAX:
| 
| xml.sax.sax2exts.XMLValParserFactory.make_parser()
| 
| or by building a DOM tree with a validating parser:
| 
| xml.dom.ext.reader.Sax2.FromXml(data, validate=1)

Note that the first method is much faster than the second, since the
second builds an object structure, while the first does not. If you
actually want the object structure, and not just the results of
validation, that may of course be worth the extra time.

--Lars M.