Generic trees are for inspection
Use Tree view to navigate configuration and feeds. Use schema- or namespace-aware processing for production transformations that depend on XML ordering and mixed content.
How do you use it?
- Paste XML or choose Open file to select a local XML document.
- Choose XML → collapsible tree and select Run, then expand catalog, book and an array entry to inspect its values.
- Choose XML → JSON for copyable output. Keep the original XML when reviewing namespace meaning or mixed text.
Worked example
Two books with separate id attributes
Input
<catalog><book id="a"><title>XML</title></book><book id="b"><title>JSON</title></book></catalog>Output
{
"catalog": {
"book": [
{
"title": "XML",
"@_id": "a"
},
{
"title": "JSON",
"@_id": "b"
}
]
}
}Expand catalog → book → 0 to find title XML and @_id a. Entry 1 has title JSON and @_id b. The array entries represent repeated book elements.
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| The parser rejects the document. | Tags are mismatched, a root is missing, or entities are malformed. | Repair the XML around the reported error before opening the tree. |
| Text and children look unfamiliar in JSON. | Mixed XML content does not map naturally to ordinary object properties. | Use a domain-specific XML parser when mixed-content ordering must be exact. |
What do attributes, namespaces and mixed text become?
These three examples were checked on 2026-10-15 with fast-xml-parser 5.11.1, using the same options as this viewer. They show the parsed object, not a lossless XML round trip.
In the namespace example, m:note and @_xmlns:m remain literal keys. In the mixed-text example, #text becomes Beforeafterend.; the original spaces and the positions of b and i among text fragments are not preserved. Keep the source for document processing that depends on those details.
Namespace prefix and declaration
Input
<m:note xmlns:m="urn:kitlumi:example" m:id="7"><m:title>XML</m:title></m:note>Actual output
{
"m:note": {
"m:title": "XML",
"@_xmlns:m": "urn:kitlumi:example",
"@_m:id": "7"
}
}Mixed text loses interleaving in an object
Input
<p>Before <b>bold</b> after <i>italic</i> end.</p>Actual output
{
"p": {
"b": "bold",
"i": "italic",
"#text": "Beforeafterend."
}
}Important behavior of XML Tree
Namespaces, mixed text content, comments, and processing instructions require format-specific interpretation beyond a generic object tree.
Standards and implementation references
- W3C XML 1.0 (opens in a new tab)Defines well-formed XML documents.
- fast-xml-parser documentation (opens in a new tab)Documents the local parser representation used by this viewer.
Frequently asked questions about XML Tree
How do XML attributes appear in the tree?
An attribute such as id="a" appears as the key @_id with the string value a. An element’s child nodes remain separate keys. The downloadable catalog sample shows both.
Why did one XML element become an array?
Repeated siblings with the same element name are grouped into an array. A single occurrence may be represented as one value instead, so consumers must account for both shapes.
Does the tree preserve namespace meaning or mixed-text order?
No. Prefixes and xmlns declarations are visible as keys, but the tool is not a namespace-aware schema validator. The object representation can combine text fragments and lose their positions among child elements.
Can I use this viewer to validate an XSD or call a SOAP endpoint?
No. The viewer parses supplied XML for inspection. It does not perform XSD validation, send SOAP requests, or upload the document for server processing.
What changed?
Added downloadable XML and parsed JSON for repeated children, namespace prefixes, and mixed text; documented the exact parser representation and source-order limits.