Getting XML to display in IE

This page was written by Steven J. DeRose in early 2003, and was last updated on 2003-04-14.

With these instructions you should be able to get a simple XML file to display reasonably in Internet Explorer 5 or greater.



First, make sure you have the XML declaration at the top:

   <?xml version="1.0"?>

As required by XML, IE will complain and stop if it finds a fatal error in your XML, so make sure your XML file is at least well-formed.

If IE reports a parsing error, I'm still trying to figure out how it counts lines of the DTD (if any), or of any external entities that are referenced. Also, like most computer languages, the error may not be noticed until considerably later than where the change should go to fix it.

If you provide no style sheet, you'll get a simple outline view of the tree of XML elements. Useful as an overview, but not very pretty.

To apply styles, insert an XML stylesheet processing instruction (per the Associating Stylesheets Recommendation):

Word will look for the stylesheet relative to the directory the XML document itself is in. So if it's not there, change the SYSTEM identifier as needed to point to it.

You won't get free formatting for HTML elements if they occur, unless the DTD you specify has a PUBLIC identifer that is one of:

I know of no way in CSS to make an element function as a link.

It seems to me that Word doesn't get namespaces quite right; it operators only on the prefix name, not the associated URI. This is at least true in IE 5.5 Mac; perhaps versions 6 and up fix this.