Using Safari To View XML Files

This blog explains how to get nicely-formatted XML in the Safari browser.


Recently we have been writing a series of blogs on the Tapestry framework showing how it can be used to create web applications. One of the blogs explains how to get the framework to return XML response for API integration. While creating the example we noticed that on OSX the Safari browser didn't give us back nicely-formatted XML files (see example)

initial in safari default.


In other browsers we did get the expected result. Since for most of the series we had been using screenshots from the Safari browser to illustrate the expected results, we wanted to stick with this browser. As it turns out, you can get nicely-formatted XML files in Safari, however this requires an additional one-time setup.

Setup for XML viewer

The get nice-formatted XML files you need to switch on developer mode. Go to Safari in the menu and select Preferences


Enable developer model by checking the last box on the advanced tab.

enable safari developer mode

Open the Web Inspector in the (new) Develop menu. web inspector

Note that the Web Inspector only needs to be opened once. After the first time XML will be rendered as you would expect. When reloading your XML you should see a nicely-formatted XML file

final xml view safari

5 thoughts on “Using Safari To View XML Files

  1. I having the same issue with my mobile view ("mobile-view" app as well as chrome/safari on iPhone & Ipad)
    Any workaround would be much appreciated,

  2. One of my safari installations only says Safari cant read RSS feeds. And keeps redirecting my xml to feed:http ... Yet on another mac I have perfectly rendered xml ... What am i missing?

Leave a Reply

Your email address will not be published. Required fields are marked *