Xerobit

XML Viewer: Parse XML into an Indented Tree

Paste XML into this xml viewer to get a tree of each node's depth, name, attributes, and text. It checks well-formedness (one root, matching tags, quoted attributes, valid entities) and reports the first error with line and column. It handles CDATA, comments, processing instructions and numeric references. DOCTYPE is not supported. Runs in your browser.

The parser reports the first well-formedness error with line and column. DOCTYPE and external entities are not supported. Limits: 2 MB of input, 400 nesting levels, first 20,000 nodes shown.

Tree

DepthNodeAttributesText
0root
1child
2#texttext

How to use the xml viewer

  1. Paste your XML into the text area of this xml viewer.
  2. The tree table appears instantly below showing Depth, Node, Attributes, and Text for each node.
  3. If the XML is not well-formed, a red error message shows the line and column of the first problem.
  4. Use the table to explore structure, verify nesting, and check attribute values.

How the XML parser works

The tool uses a hand-written state-machine tokenizer that scans the input character by character while tracking line and column numbers. When it encounters a '<' it branches: '