What this tool does
XML Formatter checks XML syntax and organizes indentation. It preserves attributes, text, and comments where possible, without inserting unnecessary whitespace into elements that mix text and tags.
- Attributes and namespaces are validated by the XML parser.
- Comments, CDATA, processing instructions, and text nodes are retained as per their respective types.
- Elements with significant mixed content will not be forced into whitespace that could alter the text.
How to use it
- Check the XML syntax of attributes and namespaces.
- Choose 2 or 4 spaces indentation.
- Click "Format XML".
- Copy the results or download formatted.xml.
Common uses
- Collate configuration files and SOAP/XML responses.
- Check that labels are nested and closed correctly.
- Read documents that contain attributes, CDATA, or duplicate nodes.
XML Formatter Features
Validate and format XML while preserving attributes, comments, and CDATA. Review the result, then copy it or download the formatted document.
FAQ
How does the tool determine that the XML is invalid?
If your input does not follow XML syntax, the tool shows an error. Check the tags, attributes, and other content indicated, then try again.
Will CDATA become normal text?
No. CDATA content and its boundary markers are preserved.
Will formatting change mixed content?
For nodes that contain both significant text and child elements, the tool avoids adding additional indentation to reduce the risk of changing the semantics of whitespace.