Displaying XML in the Chrome browser
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.
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.
I have now created a simple extension to add this functionality.
UPDATE see here for the extension.
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.