Raw XML files can be viewed in all major browsers.
Don't expect XML files to be displayed as HTML pages.
Viewing XML Files
Look at the XML file above in your browser: note.xml
Notice that an XML document will be displayed with color-coded root and child elements. A plus (+) or minus sign (-) to the left of the elements can be clicked to expand or collapse the element structure. To view the raw XML source (without the + and - signs), select "View Page Source" or "View Source" from the browser menu.
Note: In Safari 5 (and earlier), only the element text will be displayed. To view the raw XML, you must right click the page and select "View Source".
Viewing an Invalid XML File
If an erroneous XML file is opened, some browsers report the error, and some only display it incorrectly.
Try to open the following XML file in Chrome, IE, Firefox, Opera, and Safari: note_error.xml.
Other XML Examples
Viewing some XML documents will help you get the XML feeling:
An XML CD catalog
This is a CD collection, stored as XML.
An XML plant catalog
This is a plant catalog from a plant shop, stored as XML.
An XML breakfast menu
This is a breakfast food menu from a restaurant, stored as XML.
Why Does XML Display Like This?
XML documents do not carry information about how to display the data.
Since XML tags are "invented" by the author of the XML document, browsers do not know if a tag like <table> describes an HTML table or a dining table.
Without any information about how to display the data, most browsers will just display the XML document as it is.
Displaying XML Files with CSS?
Below is an example of how to use CSS to format an XML document.
Below is a fraction of the XML file. The second line links the XML file to the CSS file:
<?xml-stylesheet type="text/css" href="cd_catalog.css"?>
<TITLE>Hide your heart</TITLE>