XML Formatting and Validation: A Practical Guide
Published August 29, 2026
Prepared by Innealan Editorial
XML requires every opened element to be closed correctly and nested in the right order. Formatting it makes broken structure much easier to see.
Spot one structural failure
This document is not well-formed because the item element closes after its parent:
<feed><item>Update</feed></item>
The nesting must close in reverse order:
<feed><item>Update</item></feed>
Also check that attribute values are quoted and that there is one root element. Special characters in text need escaping: use & for an ampersand and < for a literal less-than symbol.
Format before editing
Indented XML reveals where an element starts and ends. It is useful when inspecting feeds, configuration files, exports, and API responses, but formatting does not repair incorrect tags or missing escapes.
Use the XML Formatter & Validator to validate and format XML entirely in your browser.