Skip to content
OddsockLocal
Local
Source text

Formatting

2 wordsRuns in this browser. Nothing is uploaded.

How to use

  1. Paste one XML document.
  2. Read Valid XML, or the line and column in the error.
  3. Fix a mismatched tag or a second root and run it again.
  4. Open the formatter if you also want the indented text.

What is XML validator?

The validator answers one question: is this document well formed, with a single root? <note><to>Sam</to></note> returns Valid XML. It does not indent, it does not rewrite entities into the output, and it does not tell you whether the document matches a schema. There is no XSD and no DTD check beyond what well-formedness requires.

Read more

A broken tag fails with a line and a column. <a><b></a> is the sort of mismatch that names the line rather than saying “invalid” and stopping. Two roots, such as <a/><b/>, fail because a document needs exactly one root element. Plain text fails immediately: Odd socks in the dryer. is line 1, column 1, character O is not expected.

The formatter runs the same checks and then reprints the tree. Use this page when a reprint would hide the bytes you are trying to certify, and use the formatter when you want the indented copy after the check passes.

Use cases

  • A config file should be certified Valid XML before it is copied into a deploy, without the formatter rearranging it.
  • A mismatched close tag needs a line and column, not a generic parse error.
  • Two adjacent root elements should fail so a concatenated export is caught.
  • You pasted prose by mistake and the column-1 error tells you the text never became a tag.

A small note that parses

<note><to>Sam</to></note>

Valid XML

Why use Oddsock

Valid XML is the whole result. A pretty reprint belongs on the formatter, where whitespace changes are the point.

Related tools

Using this tool

No. It means well formed, with one root. Element names are not checked against an XSD or a DTD.