XML简明教程(2)什么是XML文档

来源:互联网 发布:饮用水 知乎 编辑:程序博客网 时间:2024/05/16 00:25
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
元素,它可以嵌套XML元素。例如,下面的XML元素“bo
oks”就是一个有效的XML文档
<books>
  <book isbn="0345374827">
   <title>The Great Shark Hunt</title>
   <author>Hunter S. Thompson</author>
  </book>
</books>
处理指导
构建一个基本的XML文档需要记住关键的四点:
所有元素必须有结束标签;
所有元素必须正确的嵌套(不允许交迭元素); 

所有特征值必须加引号;
每一个文档都必须有一个唯一的第一元素和根节点。

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>