Connecting Tech Pros Worldwide Help | Site Map

XML Validation with Python

Will Stuyvesant
Guest
 
Posts: n/a
#1: Jul 18 '05
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. I have Python 2.2
but can upgrade to 2.3 beta if needed.

I am looking for something like:

"
$ python validate.py myxmlfile.xml mydtd.dtd
"

where validate.py contains something like:

"
import somexmllib
import sys

# prints 1 if Okay :-)
print somexmllib.validate(sys.argv[1], sys.argv[2])
"

I am sorry if this is a FAQ or if it is in one of the xml libraries, I
just could not figure it out!
Closed Thread