#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    71
    Rep Power
    11

    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. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    4
    Rep Power
    0

    Validating XML schema


    hello,

    Please try ExamXML at http://www.a7soft.com

    best regards.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    71
    Rep Power
    11

    Thanks


    thank you,
    It looks like a great tool to manipulate,calidate and compare xml files.
    But it's not for free.

IMN logo majestic logo spyfu logo threadwatch logo seochat tools logo