Validate XML against DTD and/or XML Schema?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Reid Priedhorsky

    #1

    Validate XML against DTD and/or XML Schema?

    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
  • Jim

    #2
    Re: Validate XML against DTD and/or XML Schema?

    For DTD's: have you stumbled across:



    ?

    Jim

    Comment

    • Ravi Teja

      #3
      Re: Validate XML against DTD and/or XML Schema?


      Not Python, but just the tool for the job.

      For Python, 4Suite has some validators. But parts of it were written in
      C and might not be helpful if you want to look at the Python source
      code. You might want to check

      for a pure Python sample. The page says it is not complete though.

      Comment

      Working...