XML Viewer

View XML as a collapsible tree.

Result

Local Your input is processed locally in your browser. Found a problem? Report an issue

What the XML Viewer does

The XML Viewer shows XML as a collapsible tree, with attributes shown as @-prefixed keys and element text as values. It is meant for finding your way around a large document, such as a feed or an export, without reading every line.

Using the XML Viewer

  • Click the name of an object or array to collapse or expand it. The number next to it is its count of keys or items.

XML Viewer example

Attributes, repeated elements and text

Input

<order id="7"><item sku="A1">Pen</item><item sku="B2">Ink &amp; paper</item><note><![CDATA[1 < 2]]></note><paid/></order>

Tree

{1}
  order {4}
    @id: "7"
    item [2]
      0 {2}
        @sku: "A1"
        #text: "Pen"
      1 {2}
        @sku: "B2"
        #text: "Ink & paper"
    note: "1 < 2"
    paid: ""

The two item elements are grouped under one item [2] row. Attributes appear as @id and @sku, element text that sits next to an attribute as #text, and the empty paid element as an empty string.

Each output was produced by running this tool on the input above it.

How it works

The XML is parsed with the browser's DOMParser and drawn as a collapsible tree. Each element becomes a key; attributes become keys prefixed with @; text next to attributes or child elements goes into #text; repeated child elements become arrays; and CDATA is merged into text. Values are inserted into the page as escaped text.

Details and limits

  • The tree shows the same structure that XML to JSON produces: attributes as @ keys, repeated elements as arrays with an item count.
  • An element with text only is shown as a string value; an empty element as an empty string.
  • Copy and Download give you that structure as JSON, not the original XML.
  • Input that is not valid XML stops the tool, and the status line shows where the problem is. The XML Validator page lists the usual causes.

Questions

Is my data uploaded when I use XML Viewer?

No. The tool runs in your browser, so what you paste or open is processed on your own device and is not sent to a server.

What does XML Viewer do?

The XML Viewer shows XML as a collapsible tree, with attributes shown as @-prefixed keys and element text as values. It is meant for finding your way around a large document, such as a feed or an export, without reading every line.

How does XML Viewer work?

The XML is parsed with the browser's DOMParser and drawn as a collapsible tree. Each element becomes a key; attributes become keys prefixed with @; text next to attributes or child elements goes into #text; repeated child elements become arrays; and CDATA is merged into text.

Are there any limits I should know about?

The tree shows the same structure that XML to JSON produces: attributes as @ keys, repeated elements as arrays with an item count. An element with text only is shown as a string value; an empty element as an empty string.

Is there a size limit?

There is no fixed size limit. Everything happens on your device, so very large inputs depend on its memory and can take longer on a phone than on a computer.

Does it work on phones, and is it free?

Yes. It works in any current browser on Android phones, iPhones, tablets and computers. It is free and needs no account or sign-up.