Validate XML against DTD and/or XML Schema?

Reid Priedhorsky reid at reidster.net
Sun Apr 16 13:09:40 EDT 2006


Hi folks,

I have a need to validate XML files against both DTDs and XML Schema from
the command line.

In an ideal world, I'd be able to do something like:

  $ python validate.py foo.xml

which would then parse and validate foo.xml using the schema or DTD
referenced within it.

What I'm looking for is the contents of validate.py. A Python solution
isn't essential, but I like Python and I'm doing some other light XML
stuff in Python, so I'd prefer it.

I did some Googling, but I'm a little overwhelmed by the quantity and
variety of stuff I found, and I found a lot of stuff that was out of date.
I thought it would be useful to ask here.

Let me know if you have any questions, and thanks very much for any help.

Reid



More information about the Python-list mailing list