An XML viewer for finding your way around a document
This XML viewer is built for the moment when you open a file and have no idea what is in it: a vendor export, a Maven POM, a feed or a configuration file that runs to thousands of lines. Instead of scrolling through markup, you get a tree you can fold and unfold, with attributes and child elements listed under each node and counts that show where the bulk of the data is.
How XML appears in the tree
Take this small catalog:
<catalog>
<book id="bk101" lang="en">
<title>XML Developer's Guide</title>
<price>44.95</price>
</book>
<book id="bk102" lang="en">
<title>Midnight Rain</title>
<price>5.95</price>
</book>
</catalog>
The tree is built from this structure:
{
"catalog": {
"book": [
{ "@id": "bk101", "@lang": "en", "title": "XML Developer's Guide", "price": "44.95" },
{ "@id": "bk102", "@lang": "en", "title": "Midnight Rain", "price": "5.95" }
]
}
}
So when you read the tree, keep three conventions in mind:
- Attributes are listed first and start with
@, so@idis theidattribute, not a child element. - Repeated siblings are grouped: the two
<book>elements appear as onebooknode marked as a list of 2 items, numbered from 0. - Text appears directly as the value when an element has only text. When it also has attributes, the text is shown under
#text.
The XML declaration and processing instructions are not part of the tree, and neither are comments. They are still in the Code tab.
Working with large files
The first two levels open automatically. Deeper branches are only rendered when you expand them, which keeps the page usable with multi-megabyte documents. A node with more than 2,000 children shows the first 2,000 and a line saying how many more there are.
A practical way to explore an unfamiliar file is to collapse everything below the root, look at the counts to find the repeating element that holds the records, then open one record to learn its shape. Once you know the path, the XPath tester lets you pull out exactly the values you need.
Code tab: formatted or minified
Every View Tree run also produces indented markup in the Code tab, using the Indent you choose. Format switches the output to indented XML only, and Minify gives you a single-line version plus the bytes saved. Use Copy or Download on whichever view you need.
When the tree does not appear
The viewer only draws a tree for well-formed XML. If the status bar shows an error such as Expected closing tag 'book' … instead of closing tag 'catalog', the file is truncated or has a broken tag at the reported line and column. Fix it in the editor and the tree reappears. HTML pages usually fail for the same reason, because tags like <br> are never closed.
Viewer or editor?
The tree is read-only; it is for looking. If you want to change values and keep checking the result, the XML editor is set up for that workflow. And if you plan to process the data in JavaScript, XML to JSON converts the same structure into a JSON document you can copy.
Privacy
Parsing and rendering happen in your browser; files you open are not uploaded. The exceptions are Load URL, which retrieves the address through our server, and Save & Share, which stores the content to create a link.