What is XML Schema Validator (XSD)?
This tool validates XML documents against XSD (XML Schema Definition) schemas. XSD is a W3C standard for defining the structure, content, and data types allowed in XML documents. It specifies which elements and attributes are required, what data types they must contain, and how they can be nested. Validating XML against an XSD schema ensures that data conforms to expected rules before processing — critical in enterprise systems, SOAP APIs, and B2B data exchange where invalid XML can cause cascading failures downstream.
How to Use
- Paste your XSD schema in the left panel, or click "Example (Valid)" or "Example (Invalid)" to load a sample schema with matching XML.
- Paste your XML document in the right panel that you want to validate against the schema.
- Click "Validate XML" to check the XML against the schema — the validator examines element names, attributes, data types, and document structure.
- Errors are shown with element paths (e.g., /bookstore/book[2]/price) so you can find exactly what needs fixing.
- Fix the XML (or XSD) and re-validate until the document passes all checks.
Why Use This Tool?
Tips & Best Practices
- The XSD must be a valid XML document itself — if the XSD has syntax errors, validation cannot proceed
- Data types like xs:integer reject decimal values like "12.5" — use xs:decimal for numbers that may contain fractions
- use="required" on xs:attribute means the attribute must appear in every instance of that element
- maxOccurs="unbounded" allows any number of repeated child elements within the parent
- minOccurs="0" makes an element optional — without it, the element is required by default
Frequently Asked Questions
What is XSD validation?
XSD validation checks that an XML document conforms to the rules defined in an XML Schema Definition. This includes verifying element names, attribute presence, data types (string, integer, date, etc.), required vs optional elements, and allowed nesting structure. It goes beyond well-formedness checking to ensure semantic correctness.
What is the difference between well-formed and valid XML?
Well-formed XML follows basic syntax rules (proper nesting, closed tags, quoted attributes). Valid XML is well-formed AND conforms to a specific schema (XSD, DTD). An XML document can be well-formed but invalid if it has correct syntax but doesn't follow the schema rules — for example, a required attribute is missing or a string appears where an integer is expected.
When should I NOT use XSD validation?
XSD validation is overkill for simple configuration files or data exchange between trusted systems where both sides already agree on the format. It's also not ideal for validating XML with highly dynamic or extensible structures — Schematron or RelaxNG may be more appropriate for rule-based or pattern-based validation that XSD cannot express.
Is my XML data sent to any server?
No. All validation happens entirely in your browser using JavaScript and the DOMParser API. Your XML documents and XSD schemas are never sent to any server, stored, or transmitted. You can safely validate documents containing sensitive business data.
What XSD data types are supported?
The validator supports common XSD data types including xs:string, xs:integer, xs:decimal, xs:boolean, xs:date, xs:dateTime, xs:float, xs:double, xs:positiveInteger, and xs:nonNegativeInteger. Each type has specific validation rules — for example, xs:integer rejects non-numeric values and xs:boolean only accepts true, false, 0, or 1.
Can I validate multiple XML files against the same schema?
Yes. Keep your XSD schema in the left panel and swap out the XML in the right panel for each document you want to validate. Click "Validate XML" for each one. This workflow is efficient when you need to validate a batch of XML files against a single schema definition.
Real-world Examples
Validating a SOAP API Response
A SOAP API returns XML that must conform to a specific schema. Validation catches a missing required "id" attribute before the response is processed by the client application.
<book><title>Missing id</title><author>Unknown</author></book>
Error: /bookstore/book[1]: Missing required attribute "id"
Catching Invalid Data Types
An XML feed has a non-numeric value in a field defined as xs:integer. The validator identifies the exact element path for quick correction.
<year>not-a-number</year>
Error: /bookstore/book[1]/year: Value "not-a-number" is not a valid integer