View the XML file


May 27, 2021 18:00 XML


Table of contents


View XML file

The XML file contains many elements, basic units of information in XML format, and other tags, as well as a wide variety of data. T his section teaches you how to view XML files.


The original XML file can be viewed in all major browsers.

Don't expect XML files to appear directly as HTML pages.


View the XML file

<?xml version="1.0" encoding="ISO-8859-1"?>
- <note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body >
</note>

View this XML file: note .xml

The XML document appears as the colored root and child elements of the code. Y ou can expand or retract the structure of an element by clicking on the plus sign to the left of the element, or minus sign (- ). To view the original XML source (excluding the plus and - symbols), select View page source code or view source files from the browser menu.

Note: In Safari, only the text of the element will be displayed. To view the original XML, you must right-click the page and select View source files.


View an invalid XML file

If an incorrect XML file is opened, the browser reports an error.

Check out this XML file: note_error.xml


Other XML instances

Check out these XML documentation, which will help you build an emotional understanding of XML.

A CD directory for XML
This is a SET of CDs that are stored as XML data.

An XML plant catalog
This is a plant catalog from a plant store that is stored as XML data.

A simple food menu
This is a breakfast menu from the restaurant, stored as XML data.


Why does XML look like this?

XML documents do not carry information about how the data is displayed.

Because the XML tag was "invented" by the author of the XML document, the browser could not determine whether a label like the one described an HTML table or a dining table.

In the absence of any information about how the data is displayed, most browsers will simply display the XML document as source code.

In the following sections, we'll look at a few solutions to this display problem, using CSS, XSLT, and JavaScript.

Tip: While mainstream browsers can support the viewing of XML files, different browsers handle XML files in different ways.


Read about it

XML elements