Advertisement
✓xml

XML Validator

Validate XML syntax and structure with detailed error messages.

Advertisement

XML Validator & Formatter

How It Works

The tool passes your XML string to the browser's native DOMParser, which parses the document according to the XML 1.0 specification. If the parser encounters a well-formedness error, it returns a parsererror document — the tool extracts the error message and line number and displays it. When the XML is valid, the tool also pretty-prints the output with consistent indentation.

Use Cases

  • Validating API response bodies before parsing them with XML libraries in Python, Java, or Node.js
  • Checking config files (Maven POM, Android manifests, Spring XML beans) for syntax errors before deploying
  • Pretty-printing raw XML payloads copied from Postman or cURL output to make them readable
  • Debugging SOAP envelopes and RSS/Atom feeds by pinpointing malformed or unclosed tags

Well-Formed vs. Valid XML

Well-formed XML follows syntactic rules: every tag is closed, attributes are quoted, and there is exactly one root element. Valid XML additionally conforms to a schema (DTD or XSD). This tool checks well-formedness using the browser's built-in parser. For full schema validation against a DTD or XSD, use xmllint or an IDE extension.

For converting between formats, see our JSON to XML and XML to JSON tools.

Frequently Asked Questions

What's the difference between well-formed and valid XML?

Well-formed XML follows syntactic rules: every tag is closed, attributes are quoted, and there is exactly one root element. Valid XML additionally conforms to a specific schema (DTD or XSD). This tool checks well-formedness — it will catch syntax errors but not schema violations.

Does this tool validate XML against a DTD or XSD schema?

No. It checks whether your XML is well-formed (correct syntax) using the browser's DOMParser. For schema validation against a DTD or XSD, you need a server-side tool or a local XML editor like VS Code with an XML extension.

Can I use this tool to pretty-print minified XML?

Yes. If your XML is valid, the tool will reformat and indent it for readability. Paste single-line or minified XML in the input field and click Run to get a neatly formatted version.

Comments

No comments yet. Be the first!