An Example

To see how xmlvalidation.com works, copy or download the XML file. It contains a reference to an XSD file, which you will also need to copy from below or download and enter into the webpage (in a second step, when you are prompted for it) to see the validation results.

Recommendation:

  • Copy and paste the XML file below into the text area on the main page (maybe on a separate tab).
  • Copy the XSD file from below so that you have it in your clipboard when you are prompted for it.
  • Click on "validate" on the main page.
  • You will be asked for the XSD file. Paste it from the clipboard into the text area.
  • Click on the button. The result will be shown.
  • Edit files and see how the error messages change according to your modifications.

You can always edit the files by just clicking on the appropriate links at the bottom of the page, which is nice for correcting errors and then downloading the validated, error-free files.

Sample XML File


<?xml version="1.0" encoding="UTF-8"?>
<addresses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xsi:noNamespaceSchemaLocation='test.xsd'>

  <address>
    <name>Joe Tester</name>
    <street>Baker street 5</street>
    <wrongExtraField/>
  </wrongClosingTag>

</addresses>

XSL for the sample XML file


<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>

 <xs:element name="addresses">
 <xs:complexType>
 <xs:sequence>
 <xs:element ref="address" minOccurs='1' maxOccurs='unbounded'/>
 </xs:sequence>
 </xs:complexType>
</xs:element>

 <xs:element name="address">
 <xs:complexType>
 <xs:sequence>
 <xs:element ref="name" minOccurs='0' maxOccurs='1'/>
 <xs:element ref="street" minOccurs='0' maxOccurs='1'/>
 </xs:sequence>
 </xs:complexType>
 </xs:element>

 <xs:element name="name" type='xs:string'/>
 <xs:element name="street" type='xs:string'/>
</xs:schema>