The XML Formatter turns compact or messy XML into a clean, indented tree that is easy to read, check and edit. Everything runs in your browser, so your data is never uploaded to a server.
Good to know
XML (Extensible Markup Language) describes data with nested tags. A document is well formed when it has a single root element, every opening tag has a matching closing tag, tags are nested correctly, attribute values are quoted and the names match exactly (XML is case sensitive).
Five characters have a special meaning in text and must be escaped: & as &, < as <, > as >, a double quote as " and an apostrophe as '. Forgetting to escape an ampersand is one of the most common reasons a document fails to parse.
When to use it
- Inspecting an XML feed, SOAP message or configuration file that arrives as one long line.
- Checking that a document is well formed before you send it to another system.
- Editing an attribute or value in a tree view without searching through raw text.
Example: Compact input and indented output
Input
<note><to>Lan</to><body>Meet at 9</body></note>
Result
<note>
<to>Lan</to>
<body>Meet at 9</body>
</note>
Common mistakes
- More than one root element. A document needs exactly one.
- Unclosed or mismatched tags, including differences in letter case (<Name> is not closed by </name>).
- An unescaped & or < inside text, such as in a URL with several query parameters.
- Well formed does not mean valid. Checking a document against a schema (XSD) is a separate step.
Frequently asked questions
- Is my XML sent to a server?
- No. The XML is parsed and formatted in your browser, so nothing you paste is uploaded.
- Does it validate my XML?
- It checks that the XML is well-formed using the browser XML parser: one root element, correctly matched tags and valid escaping. It does not validate against an XSD or DTD schema.
- Why do I get an error message?
- The message comes from the browser XML parser. The usual causes are a tag that is not closed or does not match (XML is case-sensitive), an unescaped & or < in text, more than one root element, or text before the root element.
- Does it keep comments and the XML declaration?
- No. XML comments and processing instructions are not kept, whitespace around text is trimmed, and the formatted output always starts with a standard <?xml version="1.0" encoding="UTF-8"?> line. Keep a copy of the original if you need those.
- How are elements without content written?
- As self-closing tags, for example <br /> instead of <br></br>.
- Can I edit values in the result?
- Yes. Click a text value or an attribute value in the tree, type the new value and press Enter. Press Esc to cancel.
Related searches: format xml online free · xml pretty print online · check if xml is well-formed online · xml tree viewer online
Tìm kiếm liên quan: công cụ định dạng xml online miễn phí · kiểm tra xml hợp lệ online · xem cấu trúc xml dạng cây · chỉnh sửa thuộc tính xml online