Short answer
- XML formatting changes indentation and line breaks so tags are easier to read.
- Well-formedness checks catch basic XML parse errors such as unclosed tags.
- Schema validation is separate and checks rules from an XSD, DTD, or application contract.
Formatting, parsing, and schema validation
| Check | What it answers | What it does not answer |
|---|---|---|
| Format XML | Is the markup easier to read? | Whether the XML is valid for a specific system |
| Parse XML | Is the XML well-formed? | Whether values match a schema |
| Validate schema | Does it satisfy a contract? | Whether the document is easy to read |
Well-formed XML
A well-formed XML document has matching tags, valid nesting, one document root, and syntax the parser can read.
A document can be well-formed and still rejected by an application if required elements, attributes, or values are missing.
Escaping XML-sensitive characters
Characters such as ampersands and angle brackets may need escaping when they are meant to appear as text instead of markup.
Use HTML Entity Encoder / Decoder for simple entity escaping, then review whether your XML context has stricter requirements.
When the source is YAML
YAML and XML solve different structured-data problems. Use YAML Formatter for YAML config and XML Formatter for markup or XML feeds.
FAQ
Is formatted XML the same as valid XML?
No. Formatting improves layout. Validation checks syntax or schema rules, depending on the validator.
Does Tidy Utils validate XML against an XSD?
No. The XML tool checks well-formedness and formatting, not XSD or DTD rules.
Why does XML with an ampersand fail?
A plain ampersand can start an entity reference. Use an escaped entity such as & when the ampersand is text.