search online web tools...

XML Validator

Check if your XML is well-formed

What is XML Validation?

XML validation checks whether your XML document follows the rules that make it proper XML. A well-formed XML document has matching tags, correct nesting, proper attribute syntax, and escaped special characters.

This validator catches syntax errors before they cause problems in parsers, APIs, or applications. Paste your XML, click validate, and see exactly what needs fixing.

XML Well-Formedness Rules

Valid XML must follow these rules:

  • Exactly one root element
  • All elements must have closing tags (or be self-closing)
  • Tags must nest properly (no overlapping)
  • Attribute values must be quoted
  • Element names are case-sensitive
  • Special characters must be escaped

Common Errors and Fixes

Mismatched tags: <div>content</span> - ensure opening and closing tags match exactly.

Unescaped ampersand: Use &amp; instead of & in text content.

Missing quotes: Attribute values need quotes: href="url" not href=url.

Frequently Asked Questions

What is XML validation?

XML validation checks if your XML document is well-formed (proper syntax with matching tags, correct nesting) and optionally valid against a schema (DTD or XSD). This tool checks for well-formedness.

What are common XML errors?

Common errors include: mismatched opening/closing tags, missing closing tags, invalid characters in names, unescaped special characters (&, <, >), missing root element, and incorrect attribute syntax.

What characters need escaping in XML?

Five characters must be escaped: & becomes &amp;, < becomes &lt;, > becomes &gt;, " becomes &quot;, ' becomes &apos;. Using CDATA sections is an alternative for blocks of text.

Is this tool validating against a schema?

This tool checks well-formedness (correct XML syntax). For schema validation (XSD/DTD), you'd need to provide a schema definition. Well-formedness is the foundation all XML must meet.

Loading...