Converters XML / XSD Validator

XML / XSD Validator

Check that your XML is well-formed, with an optional XSD schema to check element names. Works with files up to 200MB.

How to use this tool

Paste or upload the XML and click Validate. If it isn't well-formed, you get the line and column where the browser's parser stopped, plus its own message. To also check element names, paste or upload an XSD in the second box; every element used in the XML must be declared somewhere in it.

What the error messages mean

Chrome and Edge word the error differently from Firefox, but they point at the same spot. These are the mistakes that break real files most often, with both messages as this page shows them:

In the XMLChrome / EdgeFirefoxFix
Tom & JerryxmlParseEntityRef: no namenot well-formedWrite &
qty < 6StartTag: invalid element namenot well-formedWrite &lt;
&nbsp;499Entity 'nbsp' not definedundefined entityUse &#160;; XML only knows five named entities
<g:price> with no xmlns:gNamespace prefix g on price is not definedprefix not bound to a namespaceDeclare the prefix on the root element
Two <order> elements at the topExtra content at the end of the documentjunk after document elementWrap them in one root element
<Item>…</item>Opening and ending tag mismatchmismatched tag. Expected: </Item>Tag names are case-sensitive
A blank line before <?xml …?>XML declaration allowed only at the start of the documentXML or text declaration not at start of entityDelete everything before it

A missing closing tag is reported where the parser finds the wrong one, not where the tag was left open. In a catalogue where line 4 reads <book> instead of </book>, the error lands on line 5 at </catalog>. Chrome's message names both, "book line 4 and catalog", which tells you where to look.

What the XSD check covers

It collects every name declared on an <xs:element> in the schema and lists any element in your XML that isn't among them, ignoring namespace prefixes. That catches a misspelled or invented element such as <prise>. It doesn't check attributes, element order, how many times an element appears, or whether a value such as <price>abc</price> matches its declared type. Those need a full schema validator such as xmllint --schema, which is what a feed or API that rejects your file is usually running.

Frequently Asked Questions

Which named entities can XML use without a DTD?

Only five: &amp; &lt; &gt; &quot; and &apos;. Everything HTML adds, such as &nbsp;, &copy; or &rsquo;, is an error in XML unless a DTD defines it. Write the character itself (the file is UTF-8 by default) or a numeric reference: &#160; for a non-breaking space, &#169; for ©, &#8377; for ₹.

Why does a Google Shopping or RSS feed fail on the first g: or media: tag?

Those prefixes have to be declared before they are used, normally on the root element: xmlns:g="http://base.google.com/ns/1.0" for Google Merchant feeds, or xmlns:media="http://search.yahoo.com/mrss/" for Media RSS. Without the declaration the file isn't well-formed, so every parser rejects it, not just this one.

My XML passed here but failed in another tool — why?

That other tool is very likely doing full schema validation — checking data types, attribute constraints, element ordering, and occurrence counts — which this tool intentionally doesn't attempt client-side. A pass here confirms your XML is syntactically correct and, if you supplied an XSD, uses only declared element names; it isn't a guarantee of full schema conformance.

Related Tools

Related Blog Posts