|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Validating Xml against DTD
Hi.
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 My questions: 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: Xml code: <?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> dtd code: <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> and the "glue" code is: import os import sys 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 parser.set_error_handler(ErrorPrinter(parser, out=sys.stdout)) parser.parse_resource("/var/www/jazz/cgi-bin/mkentconfTest.xml") and it won't work ( it says that it can't find the elements) Thanks a lot Roy ![]() |
|
#2
|
|||
|
|||
|
Validating XML schema
hello,
Please try ExamXML at URL best regards. |
|
#3
|
|||
|
|||
|
Thanks
thank you,
It looks like a great tool to manipulate,calidate and compare xml files. But it's not for free. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Validating Xml against DTD |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|