XML View Plugin
Introduction
XML View Plugin is a Safari plugin that displays XML data. See this blog post for more information.
Download & Installation
xmlviewplugin.zipThe plugin requires Mac OS X 10.5 (Leopard). It will not run on older OS versions.
Download and unzip it, then put it into the Library -> Internet Plugins folder in your home folder. Restart Safari and try it out here:
Notes
It registers for the MIME types text/xml and application/xml. If you know of others that it should handle, let me know.
It handles the most common encodings, especially Unicode, but if you encounter an encoding it doesn’t handle, let me know too.
Known Issues
- Versions before 1.2 changed the default font and size for proportional text after an auto-update. If it happened to you, just reset the values in Safari’s Appearance preferences panel. I think the default is Times 16 (but I recommend you play around with these values anyway to find something you like better, while you're at it :-).
- Unfortunately the plugin seems to suppress Safari’s ability to format XML with an associated XSLT style sheet (example here). For now you need to remove the plugin if that is important for you.
- It also seems to break the event detail view of Google Calendar and it doesn’t look like that can be avoided. In the case of the event detail link in their e-mail notifications, they seem to send HTML, but declare it with the wrong MIME type text/xml. (Update: I heard that Google Calendar works in Safari 4 Beta...)
- If you customize the display (see below), you should note that it is currently not possible to use effects that are based on mouse-moved events. This means that you can’t use the CSS
:hoverpseudo-class, and JavaScriptonmouseoveretc. won’t work. This might be a bug in the operating system and I can only wait for it to get fixed. - The ACID 3 test doesn’t run all the way through to 100 in Safari 4. Again, this is a problem of the MIME they use and there’s nothing I can do about it.
Customization
You can customize the “Formatted and Styled” view in the plug-in’s Preferences dialog. In this view, the plugin converts the XML document into an HTML page, and you can change the appearance and behavior of that page with CSS and JavaScript in the usual web developer way.

This customization can range from simple syntax coloring color changes to highly interactive mini
applications customized for your particular XML format. The markup uses lots of CSS classes
and you get access to the prototype.js library in the page.
Since you cannot view the source of the internal HTML representation used by the plugin directly in the browser, here’s an example document. If you know XSLT, a look at the transformation the plugin uses to convert XML to HTML might also be useful.
The two default CSS and JavaScript snippets in the Preferences should get you started. If you mess it up, you can always click the Reset button to restore the factory defaults.
Release Notes
License / Source Code
The program is free. If you like it, you can make a donation or send me something from my wish list :-).
The source code Xcode project package is available on github.
