March 7th, 2004, 05:01 PM
Validating Xml against DTD
I am trying to validate xml doc. against a DTD .
I'm using Debian's package "Python2.3-xml", but it just won't work
1. How to validate xml with dtd using this package? ( I couldn't find any
documentation, it looks like a great package, but no docs available)
2. How to validate xml against dtd with any alternative Debian's package?
3. Is there a Debian package to validate xml against Xml schema?
I tried to validating something realy simple, like:
<body>Don't forget me this weekend!</body>
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
and the "glue" code is:
from xml.parsers.xmlproc import xmlval
from xml.parsers.xmlproc.utils import validate_doc, load_dtd, ErrorPrinter
dtd = load_dtd("/var/www/jazz/cgi-bin/mkentTest.dtd")
parser = xmlval.XMLValidator()
parser.dtd = dtd
and it won't work ( it says that it can't find the elements)
Thanks a lot
It looks like a great tool to manipulate,calidate and compare xml files.
But it's not for free.