About xml parser & formatter
XML is hard to read when it arrives on one line. The formatter indents it, checks that it is well-formed and shows the structure as a tree.
Well-formed means
- A single root element.
- Every opening tag has a matching closing tag, in the right order.
- Attribute values are quoted, and special characters are escaped.
A worked example
A single-line feed such as <order id="7"><item>Pen</item><item>Book</item></order> is indented so each item sits on its own line. If a tag is not closed or an ampersand is not written as &, the tool shows the position of the error.
Where XML is still common
- SOAP web services and many enterprise systems.
- RSS feeds and sitemaps.
- Android layouts and Maven build files.
Minifying
Minifying XML removes the whitespace between tags to reduce size. Keep whitespace inside text nodes, because some formats treat it as data.
