You can use IE 5.0 (or a later version) or Netscape 6 to view the original XML file. However, if you want to display the XML file as a Web page, you must add additional display information.
View XML files
We can use ie5.0 (or a later version) to browse XML documents. You can click a hyperlink, enter a URL in the address bar of the browser, or double-click the XML document in the folder. If you use IE to open the XML document and find that the browser uses the root element and child element of the XML document with a color, there is a "+" number on the left of the XML element, click "+" to expand the next level structure of the element. If there is a "-" number on the left of the element, you can also click the "-" number, collect the next level structure of this element. If you want to view the source file of the XML document, you can right-click the source file and choose View Source file ".
We can also use Netscape 6 to open the XML document, or right-click and select "View Source File". When you open the XML document with Netscape 6, the browser will use the colorCodeDisplays the root element and child element.
<? XML version = "1.0" encoding = "ISO-8859-1"?>
-<! --
Edited with XML spy v4.2
-->
-<Breakfast_menu>
-<Food>
<Name> Belgian waffles </Name>
<Price> $5.95 </price>
<Description> two of our famous Belgian waffles with plenty of real maple syrup </description>
<Calories> 650 </calories>
</Food>
-<Food>
<Name> strawberry Belgian waffles </Name>
<Price> $7.95 </price>
<Description> light Belgian waffles covered with strawberries and whipped cream </description>
<Calories> 900 </calories>
</Food>
-<Food>
<Name> berry-berry Belgian waffles </Name>
<Price> $8.95 </price>
<Description> light Belgian waffles covered with an assortment of fresh berries and whipped cream </description>
<Calories> 900 </calories>
</Food>
-<Food>
<Name> french toast </Name>
<Price> $4.50 </price>
<Description> thick slices made from our homemade sourdough bread </description>
<Calories> 600 </calories>
</Food>
-<Food>
<Name> Homestyle breakfast </Name>
<Price> $6.95 </price>
<Description> two eggs, bacon or sausage, toast, and our ever-popular hash browns </description>
<Calories> 950 </calories>
</Food>
</Breakfast_menu>
Why is XML displayed in the browser?
A simple XML document does not contain information about how to display data.
Since XML tags are "created" and "invented" by the authors of XML documents, we cannot know whether a <Table> tag is a table in HTML or a wooden table.
Without any additional information, ie usually displays XML data in a tree view.
In the following pass section, we will describe some solutions to XML document display problems, including CSS, XSL, JavaScript, and XML data islands.