查看 XML 文件

  要领:

在所有现代浏览器中,能够查看原始的 XML 文件。

不要指望 XML 文件会直接显示为 HTML 页面。

查看 XML 文件

打开 XML 文件 - XML 文档将显示为代码颜色化的根以及子元素。通过点击元素左侧的加号或减号,可以展开或收起元素的结构。如需查看不带有 + 和 - 符号的源代码,请从浏览器菜单中选择“查看源代码”。

注释:在 Netscape, Opera 以及 Safari 中,仅仅会显示元素文本!要查看原始的 XML,请右击页面,然后选择“查看源代码”。

 
其他的 XML 实例

请查看这些 XML 文档,这会有助于您建立对 XML 的感性认识。 

一个简单的菜单
这是来自餐馆的早餐菜单,存储为 XML 数据。
  <?xml version="1.0" encoding="ISO-8859-1" ?>
- < 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 >

为什么 XML 会这样显示?

XML 文档不会携带有关如何显示数据的信息

由于 XML 标签由 XML 文档的作者“发明”,浏览器无法确定像 <table> 这样一个标签究竟描述一个 HTML 表格还是一个餐桌。

在没有任何有关如何显示数据的信息的情况下,大多数的浏览器都会仅仅把 XML 文档显示为源代码。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值