Viewing XML Files
Raw XML files can be viewed in all major browsers.
Don't expect XML files to be displayed as HTML pages.
Viewing XML Files
<?xml version="1.0" encoding="ISO-8859-1"?>
<body>Don't forget me this weekend!</body>
Look at this XML file: note.xml
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.
Note: In Netscape, Opera, and Safari, 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, the browser will report the error.
Look at this XML file:
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 data.
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
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
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The XML Certificate is for developers who want to document their knowledge of XML, XML DOM and XSLT.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
The PHP Certificate is for developers who want to document their knowledge of PHP and SQL (MySQL).