Validate XML

Check XML well-formedness, matching tags, entities, and document structure.

freeworks offlinenothing uploaded
ToolXML Validator
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The parser checks matching tags, quoted attributes, entity syntax, declarations, and root structure, then returns its line and column for failures. It checks well-formedness only and does not load a DTD or XSD.

  • Well-formedness is the portable baseline.
  • Avoiding external schemas keeps the browser check deterministic.

Worked example

Valid book catalog XML
Validate a well-formed XML document with attributes
Input
											<?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <book id="1">
    <title>Clean Code</title>
    <author>Robert C. Martin</author>
    <year>2008</year>
  </book>
  <book id="2">
    <title>The Pragmatic Programmer</title>
    <author>David Thomas</author>
    <year>1999</year>
  </book>
</catalog>
										
Output
												Valid: yes
											

When to use this

CI packaging, SOAP fixtures, and SVG or RSS authoring validate XML.

Edge cases

  • An unescaped ampersand fails unless it starts an entity.
  • Two root elements are not well formed.
  • Valid XML can still violate an application XSD because no schema is loaded.

References