71

I love the Chrome browser, but I use XML quite a lot in my development work and when I view it in Chrome I just get the rendered text.

I know that the source view is slightly better, but I'd really like to see the layout and functionality that Internet Explorer adds to XML, namely:

  • Highlighting
  • Open/close nodes

Any ideas how I can get this on Chrome?


UPDATE:

The XMLTree Extension is available on Google Chrome Extension Beta Site.

Josh
  • 1,652

8 Answers8

30

I have now created a simple extension to add this functionality.

UPDATE see here for the extension.

studiohack
  • 13,477
Josh
  • 1,652
20

I guess your best bet is to use a bookmarklet or install Greasemetal (which is Firefox' Greasemonkey for Chrome), combined with a script like XML Tree (old, but the source may still help). A more generic syntax highlighting script may help as well, but I doubt if you'll easily find one with code folding.

Note that whitespace might matter in XML. Not all XML viewers respect that; the screenshot created by the abovementioned XML Tree for the example XML does not respect it for the line Sample XML element containing a lot of text, enough to be put on a separate line.

(Unfortunately jsgui.com/xml-viewer is not responding while I am writing this.)

EDIT: How to print pretty xml in javascript? on Stack Overflow mentioned a newer version of XML Tree: Pretty XML Tree, using XSLT and claims to be faster. The demo does not respond to clicking in my Safari or Firefox, but may be helpful anyway.

Arjan
  • 31,511
6

As far as I understand it the limitation is actually in the webkit rendering engine rather than in Chrome itself. I doubt we'll decent XML rendering in Chrome before they properly launch extensions, at which time someone will be able to code a community extension to handle text/xml files.

If you want an alternative to IE, the Firefox rendering of XML is pretty good.

6

If you right-click on a node, and click "Inspect Element", you should get the WebKit Web Inspector, which has lots of fancy features including what you need; this should work for XML in addition to just HTML. Here's a screenshot from Safari, which has the same inspector:

Web Inspector

Gareth
  • 19,080
jtbandes
  • 8,960
5

Chrome dev channel now features an XML viewer, which is invoked if the XML does not have an associated XSL (the same holds for the WebKit nightlies). Happy viewing!

apavlov
  • 51
2

I've tried many, but only XV — XML Viewer works for both regular XML and RSS feeds (if you turn it on in the settings).

John Sheehan
  • 1,676
1

No need for fancy extensions(Which breaks if you load a 1MB sized XML file).

This post is old, but right now Chrome has fixed the bug and has added support for viewing XML directly in the browser. Just drag and drop any XML file and you can see the collapsible tree view of the file. It also supports viewing RSS feeds.

Lucky
  • 450
0

In my case (SharePoint 2013 REST API response ) XML Tree wins XV — XML Viewer

  • perfect Tag matching and highlighting on mouse over
  • unbeatable intuitive tree view format

Extra advanced features

  • XPATH query

    enter image description here

(in fact i installed XV first and it did nothing with my xml, but XML tree rocks it)

Iman
  • 539