The best way I have found so far is to first write an example input XML file and then try to validate Good question.
Perhaps "validate" isn't the best verb here, as you "validate" an xml against a xsd, which is not you are asking about.
An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntactical constraints imposed by XML itself.
These constraints are generally expressed using some combination of grammatical rules governing the order of elements, Boolean predicates that the content must satisfy, data types governing the content of elements and attributes, and more specialized rules such as uniqueness and referential integrity constraints.
But I have gone through the same process, used example input to check the xsd, and found myself later having to change the xsd because of corner cases that weren't tested for.
Because some commercial editors are already mentioned, in the meantime there are also other tools available for a more reasonable price.
You didn't specify the source language, but it's only a few lines of code to write a schema validator in Java or . There also appears to be an on-line schema validator but I can't vouch for its quality.
All XML documents must be well-formed, but it is not required that a document be valid unless the XML parser is "validating", in which case the document is also checked for conformance with its associated schema.
DTD-validating parsers are most common, but some support XML Schema or RELAX NG as well.
Two more expressive XML schema languages in widespread use are XML Schema (with a capital S) and RELAX NG.
The mechanism for associating an XML document with a schema varies according to the schema language.