tags:

views:

49

answers:

1

I have a schema that I would like to validate (note: not a document, but the schema itself) for correctness and catching any silly errors. The schema references other schemas, which are all together in the same directory. We can't host the schema publicly just yet.

Is there a command-line tool or script for any recent Windows or Unix OS which will allow me to validate each of the schemas and get a report (in any reasonable format)? I don't really want a GUI.

A: 

I am using ant for validation (and other XML tasks, like XSLT transformations). The Validate Task allows you to validate one or more documents. In your specific case, for validating XML Schemas, you need to validate it with the XML Schema Schema.

Tim Jansen
That looks good, but I think I want not only validation, but also warnings and suggestions -- much like you'd get from a static analysis checker. Will ant do that for me? I'd +1 you but I don't have 15 rep yet.
Kevin Stargel
Originally I had the wrong link (to xmlvalidate instead of schemavalidate). Using the "warn" attribute you could also get warnings. With failonerror=false ant would not abort anymore. Using loggers (http://ant.apache.org/manual/listeners.html) you can change the output format to get a report-like format.
Tim Jansen