tags:

views:

2197

answers:

5

I'm writing a xml schema (a xsd) to describe the format our partners should send us data in.

And I'm havening a hard time find a tool that can validate the xsd file that i have written.

The best way I have found so far is to write an example input xml file and try to validate that with the xsd. But that doesn't feel like a best practice maneuver.

How should I validate a xml schema?

+1  A: 

If this is a short-term thing, you could use an evaluation copy of a tool like Stylus Studio.

If it's long-term maintenance, you might want to consider purchasing an XML schema editor like Stylus, or Oxygen or Altova.

You didn't specify the source language, but it's only a few lines of code to write a schema validator in Java or .Net.

There also appears to be an on-line schema validator but I can't vouch for its quality.

lavinio
And if you are at the start of projects that will produce schemas that refer to each other, or WSDL to WSDL to Schema, then also look at Altova SchemaAgent, which can not only visualise and validate such references, but can also serve up a set of schemas to your organization, or to the Internet.
John Saunders
One open source tool that i found is xmllint, which i use like this:xmllint --noout --schema http://www.w3.org/2001/XMLSchema.xsd mySchema.xsd
Alexander Kjäll
+1  A: 

the Java SDK comes with a standard tool called xjc . This tool generates the classes parsing your schema. You could use this code to validate your partners' input.

See also : http://www.java2s.com/Tutorial/Java/0440__XML/ThexjcTool.htm

Pierre
A: 

If you have Visual Studio, you can use that to validate an XML file against a schema manually.

If you're prepared to write some code, it's pretty straightforward to do it using the .NET framework, which provides all kinds of classes for reading and processing XML files, including validating the XML against a schema.

Gary McGill
A: 

To validate an XSD you can use XML ValidatorBuddy from http://www.xml-tools.com in combination with the AltovaXML parser. Once you have installed both you can validate your XSD directly from the Windows File Explorer.

xml-tools.com
+1  A: 

The W3C has a online validator for XML Schemas at http://www.w3.org/2001/03/webdata/xsv. Since W3C is the source of the XML Schema spec, their validator should be trustworthy.

Matt Lavin