Random bits of free software

XMLTree2

XMLTree2 is a piece of UserJs for the Opera browser. It is activated automatically on raw XML files and renders them as a colorized tree, with proper indentation and dynamic collapsing/expanding behaviour. It is needed because Opera won't display un-styled XML as a source tree, as other browsers do. Fortunately we can add this behaviour with UserJs. XMLTree2 is inspired by, and is intended as a better implementation of XML Tree by TarquinWJ.

Features

Very fast

The reason I wrote this script in the first place is that TarquinWJ's one was very slow even on moderately-sized XML files on my old hardware. My script is an order of magnitude faster, as it traverses the source document and constructs the tree view exclusively through the DOM API.

High level view

XMLTree2 puts an emphasis on XML readability, with proper indentation, coloring, and hiding of representation details such as CDATA sections, entities and processing directives. When you look at an XML file in a browser you usually need to see its contents: element structure, attributes and text. If you're interested in representation-level details you should be reading the raw source anyway, because any additional processing will alter them. A good way to do so is to set your programming editor as the source-viewing program in Opera's preferences.

Customizable

You can choose from a couple predefined color schemes for the XML tree view, or write your own. Font, indentation and other details are easy to customize as well.

Download

xmltree2.js (size: 8.8K; license: BSD-like; last updated on 8 Oct 2008)

Install by copying it to Opera's UserJs directory. You don't need to restart Opera. Test by opening a random XML file.

This personal web site is not affiliated with, nor does it represent the views, position or attitude of my employer or of their clients.