Skip to main content

How display XML?

View XML Files

Raw XML files can be viewed in all major browsers.

You just need to drag and drop your XML file into the browser to open it.

note

Don't expect XML files to be displayed as HTML pages. XML files don't have style code!

But most browsers will display an XML document with color-coded elements.

For example this XML code

<table xmlns="http://www.w3.org/TR/html4/">  
<tr>
<td>Milan</td>
<td>Rome</td>
<td>Venice</td>
</tr>
</table>

will be viewed as

Example of XML code

note

Some browsers report errors if an invalid XML file is opened, others show an error message or highlight the wrong XML code.

This behavior of browsers is not standard.

Why is the style missing in the XML code?

XML documents do not carry information about how to display the data.

Each XML tag has a meaning for the author of the XML file. Browsers can't know what meaning is given to the tags and so they don't know how to display the data.

note

If you want to style an XML document, use XSLT.