XML Validation with Python

Alan Kennedy alanmk at hotmail.com
Thu Jul 3 14:23:33 CEST 2003


Will Stuyvesant wrote:

> Can you give a commandline example how to do XML Validation (checking
> against a DTD) with Python?  Not with 4Suite or other 3rd party
> libraries, just the Python standard distribution.  

You can't do it. The base distribution doesn't include a validating
XML parser.

The only pure python validating parser is Lars Garshol's "xmlproc",
which is a part of pyxml (a "third-party" optional extension). You can
read the documentation for xmlproc here

http://www.garshol.priv.no/download/software/xmlproc/

and the bit about validating on the command line is here

http://www.garshol.priv.no/download/software/xmlproc/cmdline.html

Is there any reason why it has to be in the base distribution?

Assuming that you have a good reason, maybe you can tell us what
platform you're running on? There might be a platform specific
parser/validator that you can call from python.

HTH,

-- 
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan:              http://xhaus.com/mailto/alan




More information about the Python-list mailing list