This tool validates XML with the browser's own parser — DOMParser, parsing your input as text/xml — rather than a separate, custom-written checker. If the browser's parser accepts the document, the tool reports it valid; if the parser flags a parsererror node, that is what drives the red ⚠ indicator next to the XML Original tab.
The examples below are common ways real XML breaks. Rather than quoting a specific browser's error text — DOMParser's wording differs across Chromium, Firefox and WebKit, so a string that is exactly right in one is misleading in another — each one names the well-formedness rule it breaks, which is the same across every conformant parser even when the wording of the error is not.
How it works
Well-formed versus valid: two different questions
A document can be perfectly well-formed — every tag closed, correctly nested, one root — while still being the wrong shape for what a consumer expects: a missing required element, an attribute in the wrong place, a child element that should not be there. That second, stricter question is schema validity, checked against a DTD or an XSD, and it is a different job from what this tool does.
This distinction matters because “my XML validator says it's fine” and “my SOAP client rejects it” are both true statements about the same document when the problem is schema shape rather than syntax. This tool answers the first question; a schema validator, checked against the specific DTD or XSD your system expects, answers the second.
Why the exact error wording is left unspecified here
DOMParser is a real, shipping browser API, but its error reporting was never standardized in detail — each engine's XML parser (libxml2-derived in some, a bespoke parser in others) writes its own message text for the same underlying problem. Rather than publish one browser's wording as if it were universal, the rule each example breaks is described directly; that rule is identical everywhere, which the specific sentence describing it is not.
Not well-formed, and which rule it breaks
The exact error text depends on which browser's XML parser produced it, so each example names the well-formedness rule instead — that rule is the same everywhere.
<book><title>Dune</title></books>Every start tag must be matched by an end tag with the identical, case-sensitive name. <book> was opened and </books> was closed — a different name — so the document is not well-formed.
<book category=cooking>...</book>Attribute values must be quoted, with either " or '. Unlike HTML, XML has no shorthand for an unquoted value — this is one of the most common breakages when XML is hand-edited by someone used to HTML.
<book>Dune</book><book>Foundation</book>A well-formed XML document has exactly one root element containing everything else. Two sibling elements with nothing wrapping them is not one document — wrap them in a common parent.
<company>Tom & Jerry Inc.</company>& always begins an entity reference (&, &, a custom entity) to an XML parser, so a literal ampersand in text content must be written &. This is invisible in plain text but breaks parsing immediately.
Known limitations
- Validation here checks well-formedness only — the generic XML syntax rules. It does not check a document against a DTD or an XSD schema, so a well-formed document with the wrong elements, wrong attributes, or wrong structure for your specific format will still be reported valid.
- The exact error message shown depends on which browser you are using, since DOMParser's error text is not standardized across engines. The rule being violated is consistent; the sentence describing it is not.
Validate XML FAQ
Does "well-formed" mean my XML matches the schema my API expects?
No — those are different checks. Well-formed means the tags are correctly nested and closed. Whether the elements and attributes match what a specific API or format expects is schema validation, against a DTD or XSD, which this tool does not perform.
Why is a literal & rejected when it looks like ordinary text?
Because & always starts an entity reference to an XML parser, whether you intended that or not. Write & for a literal ampersand in text content.
Can a document have more than one root element?
No. A well-formed XML document has exactly one element containing everything else. Two top-level sibling elements need a common wrapping parent.
Is my XML uploaded to check it?
No. Validation runs through your browser's own DOMParser, locally — nothing is sent anywhere.
Other XML tools
Need the full formatter, without a specific guide attached? The general XML formatter has the same beautifier and Compact Mode switch.