Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?


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

share|improve this question
Hmm... uh, firefox? –  RCIX Jul 21 '09 at 5:50
come on guys - use firefox answers aren't really helpful. –  Josh Jul 21 '09 at 9:34
Nice extension. Why don't you move your solution into its own answer, so you can accept it and it can be upvoted? –  arathorn Jul 22 '09 at 15:28
@arathorn - i have now added the plug-in as an answer - thanks. –  Josh Jul 22 '09 at 15:53
@Josh: Don't you want to change your accepted answer, also? (I assume that's possible.) –  arathorn Jul 22 '09 at 16:23

6 Answers 6

up vote 16 down vote accepted

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.

share|improve this answer
thanks - put me on the right track. got a working extension based on the xml tree script. –  Josh Jul 22 '09 at 10:19
@Josh, though I'm not using Chrome: thanks for the plug-in! –  Arjan Jul 22 '09 at 14:27
i've updated my extension to use xslt and a simular idea to pretty xml tree - but i hope working better :) - let me know what you think - same link as before. –  Josh Aug 5 '09 at 8:24
(I'm still not using Chrome, but given the earlier comments I read at chromeplugins.org/google/chrome-plugins/… I'm sure people are happy!) –  Arjan Aug 5 '09 at 19:44

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

UPDATE see here for the extension.

share|improve this answer
nice one ... it works great :-) –  LiorH Apr 5 '10 at 11:43
very nice! thanks –  user27654 Aug 8 '10 at 20:46
very useful extension, thanks for sharing –  Pavel Feldman Sep 2 '10 at 20:20
Can you make it work for download links to XML files? Chrome keeps asking me to save the file to disk :( –  sorin Aug 9 '13 at 11:00
Josh, that extension is now maintained by someone else? –  Arjan Aug 15 '13 at 12:07

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.

share|improve this answer
Either that, or they'll just create an extension equivalent to Firefox's "IE Tab," or perhaps "Firefox Tab" if you will. addons.mozilla.org/en-US/firefox/addon/1419 –  MatrixFrog Jul 19 '09 at 20:36
@MatrixFrog FF-tab for chrome, in which you can run IE-Tab for FF? ;D –  pavsaund Jul 22 '09 at 6:57

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

share|improve this answer
+1 this looks like the original poster's answer. I just checked and the "inspect element" option is there when viewing a raw XML file. It would be nice if this was the default rendering option for non HTML XML files; however two clicks isn't that much of a price to pay :) –  Russell Heilling Jul 22 '09 at 8:16
very cool - just a shame its not the default option for xml. –  Josh Jul 22 '09 at 8:30
Well, yeah. The problem is the browser has no way to know whether you want it to render the document or not, since XML is a perfectly valid medium for web pages (for example, homepage.mac.com/nathan_day/pages/news.xml). The Web Inspector is really just a developer tool (an awesome one!). By the way, Josh, did this count as the answer to the original question? –  jtbandes Jul 22 '09 at 8:43
It is a shame it's not the default renderer. Several times I have been forced to use IE for this purpose even though chrome is my browser of choice. Regarding, how will the browser know how to display the document? I don't care! Somehow IE and Firefox figure it out. Maybe something in the stylesheet, guesswork, magic...just do it! –  Tundey Jul 22 '09 at 14:30
@jtbandes - the script idea from @Arjan van Bentem was the best answer as it helped create the extension which i've also added as an answer. –  Josh Jul 22 '09 at 15:55

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!

share|improve this answer
Yup! It's landed in the stable releases now I believe. code.google.com/p/chromium/issues/detail?id=434 –  ken May 10 '11 at 18:00

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).

share|improve this answer
That's great, that option was exactly what I was looking for. –  huyz Aug 13 '14 at 10:00

protected by nhinkle Apr 27 '11 at 0:05

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.