Viewing XML Files
Raw XML files can be viewed in Mozilla, Firefox, Opera, Internet
Explorer, and
Netscape 6+.
However, to make XML documents display as nice web pages, you
will have to add some display
information.
Viewing XML Files
In Firefox and Internet Explorer:
Open the XML file (typically by clicking on a link) - The 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.
In Netscape 6:
Open the XML file,
then right-click in XML file and select "View Page Source". The XML document
will then be displayed with color-coded root
and child elements.
In Opera 7 and 8:
In Opera 7: Open the XML file,
then right-click in XML file and select "Frame" / "View Source". The XML document
will be displayed as plain text. In Opera 8: Open the XML file,
then right-click in XML file and select "Source". The XML document
will be displayed as plain text.
Look at this XML file: note.xml
Note: Do not expect XML files to be formatted like HTML documents!
Viewing an Invalid XML File
If an erroneous XML file is opened, the browser will report the error.
Look at this XML file:
note_error.xml
Other XML Examples
Viewing some XML documents will help you get the XML feeling.
An XML CD catalog
This is my father's CD collection, stored as XML data (old and boring titles
I guess... :-)).
An XML plant catalog
This is a plant catalog from a plant shop, stored as XML data.
A Simple Food Menu
This is a breakfast food menu from a restaurant, stored as XML data.
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.
In the next chapters, we will take a look at different solutions to the
display problem, using CSS, XSL, JavaScript, and XML Data Islands.
|