Advertisement

XML (二)

阅读量:

1.2.1 XML Tree结构

XML文档以element tree格式进行表示,一个xml tree的结构始于根元素,并由此扩展至各个子元素。在这一结构中,每个元素均可包含其对应的子元素(child elements):

复制代码
 <root>

    
   <child>
    
     <subchild>.....</subchild>
    
   </child>
    
  </root>
    
    
    
    

这组parent、child、subchild用于表达各元素间的关联性。Parent包含child,而child则对应parent与subchild,并处于同一层级。每个元素均包含文本内容(如Harry Potter)以及属性信息(category=“cooking”)。

2.1 自我描述的语法

XML文档中所采用的语法结构大多由用户自行定义,其版本声明及字符编码方式如下所示:

紧接着的是XML文档的根元素:

随后出现的是一个标签:

标签内部包含四个子元素,分别为:、<author</p> </div></div><!----><!--]--></div><!--[--><div class="flex justify-center items-center mt-14 mb-7 text-gray-500 relative"><h2> 全部评论 (<span>0</span>) </h2></div><div class="w-full px-5 py-10 mb-3 bg-white border border-gray-200 rounded-lg dark:bg-gray-800 dark:border-gray-700"><!----><div class="flex items-center mt-10 mb-5 justify-center text-gray-400"> 还没有任何评论哟~ </div></div><!--]--><div class="related-articles" data-v-218c16d3><h3 class="related-title" data-v-218c16d3>相关文章推荐</h3><div class="article-grid" data-v-218c16d3><!--[--><!--]--></div></div></div><aside class="w-full md:w-[17%] lg:w-[17%] order-3 md:order-none" style="position:relative;z-index:5;" data-v-218c16d3><div data-v-218c16d3><!--[--><div class="gradient-bg w-full py-5 px-2 mb-3 bg-white border border-gray-200 rounded-lg dark:bg-gray-800 dark:border-gray-700" data-v-b007e0bf><div class="flex items-center justify-between" data-v-b007e0bf><div class="text-red-600 font-bold" data-v-b007e0bf>未开通会员</div><button class="px-4 py-2 text-yellow-300 font-bold bg-black rounded-full" data-v-b007e0bf> 开通会员 </button></div><p class="mt-2 text-gray-600" data-v-b007e0bf>会员专享资源、会员博客等服务</p></div><div class="w-full py-5 px-2 mb-3 bg-white border border-gray-200 rounded-lg dark:bg-gray-800 dark:border-gray-700" data-v-b007e0bf><div data-v-b007e0bf><div class="flex flex-col items-center" data-v-b007e0bf><div class="relative mb-4 mt-6" data-v-b007e0bf><button class="px-4 py-2 rounded" data-v-b007e0bf>点击登录</button></div><div class="flex justify-center gap-5 mb-2 dark:text-gray-400" data-v-b007e0bf><div class="flex items-center flex-col gap-1 hover:text-sky-600 hover:scale-110 cursor-pointer" data-v-b007e0bf><button class="text-sm" style="width:80px;height:35px;border:1px solid #c9c9c9;background-color:#fff;color:#555;" data-v-b007e0bf> 下载历史 </button></div><div class="flex items-center flex-col gap-1 hover:text-sky-600 hover:scale-110 cursor-pointer" data-v-b007e0bf><button class="text-sm" style="width:80px;height:35px;border:1px solid #c9c9c9;background-color:#fff;color:#555;" data-v-b007e0bf> 积分购买 </button></div></div></div></div></div><!--]--></div><!----></aside><div class="w-full md:w-[18%] lg:w-[18%] order-3 md:order-none" data-v-218c16d3></div></div></div></div></main><span data-v-218c16d3></span></div><footer class="bg-white mt-5 dark:bg-gray-800 text-right" data-v-218c16d3><div class="w-full mx-auto max-w-screen-xl py-1 px-4"><span class="text-sm text-gray-500 sm:text-center dark:text-gray-400 w-full mb-2 md:mb-0"><a href="https://d.itadn.com/contact" class="hover:underline mr-12">免责声明</a></span></div><div class="w-full mx-auto max-w-screen-xl py-1 px-4 flex justify-end items-center"><a href="https://beian.miit.gov.cn" class="flex items-center"><img src="https://b.itadn.com/_nuxt/police.DzUIhgta.png" alt="备案号图标" class="h-4 w-4 mr-2"><span class="text-sm font-medium text-gray-500 dark:text-gray-400 hover:underline"> 鲁ICP备2023021068号-1 </span></a></div><div class="w-full mx-auto max-w-screen-xl py-1 px-4 flex justify-end"><span class="text-sm text-gray-500 dark:text-gray-400"> © 2024 <a href="https://www.itadn.com/" class="hover:underline">技术社区</a> .All Rights Reserved. </span></div></footer><!--]--></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="true" id="__NUXT_DATA__">[["ShallowReactive",1],{"data":2,"state":18,"once":28,"_errors":29,"serverRendered":5,"path":31},["ShallowReactive",3],{"$fHfSeYX95Gb6i7b0pKYebZy8EvZavrJ7spzj612vIfB8":4,"$fBWYCX9Fo0KUz04rjB3aG8_QvEcul-JQUtWwucpKu4lA":15},{"success":5,"message":6,"errorCode":6,"data":7},true,null,{"current":8,"size":9,"id":10,"flag":6,"username":6,"q":6,"t":11,"title":12,"content":13,"readNum":6,"listId":6,"vipFree":14,"summary":6,"status":8},1,10,3398834,"a","XML (二)","5kaBla0EtIHHGbiB/fwFYHr8ogBdOFERpeWiMGsrmGIOCqr4h4aYAVhr7UDkrodZ+WtlXDIxAIAp996mkC2dgdfGZTTf6yqOwxw1Z6pSaMP8v9pqL/hgIkILd1NEI7+NXLUeq6qPvXMa+Zr1KJtFEnMZp7ORXnQd898fq70WrPJZLss3FB4CAVQGPNriBDYTVKltoTT9zLnQNwoAzkeGdKmLAtISo2MC8hEuMxvMc81Z+wrSkfblh2riCVaFGd5ZPom+/fxtxeZJ7jVYPgW5sw2WfiXMhRKEo76SpwXj3brs6QnWm19noQl4t/F+W9mBhOQRE8P8w2Gs1Zu9x4Y3Q5pmgIOX8D5UpTttB+gSIDoteQQaZzsuWCZHT6YLa7RLfIc1dUBDaqxaeYKhmCnoz9Wj1rGKAEzbkHYOCrje3C+lAjnHHsLudsihZr8T2XCS8ZFLrXjObDAFdkK2XNbnXJK0LJ1odICJs+tXOCVtSxK6R4eQWAlDmG3EJJEMnzmW8gZPE5kBdgifFcutpjrIHN9HTxqP8Ti/zSs56r33BZpd0HGXmc2WosIafzvk4hkoHdat3nC4Yr51arwDLvWTcroWaCp57runGhMvwaiX75k8Vk+dfTTbyhP3HO4PTLdp0hNtXnDy8d62a1iZzTt5Ik/PSKVCvni8iXkK+Up4Hy9/LdOZRB1VE/r8E7Z7Yjhq3Q98sOk5y7QM7Y927aoVVOYsP7dQuZFpQS6zmcAgoxTQR0nLYcwt6OxLT1eFY2Bdre80CkmG8wbpHRy6bKqIMz9AOMH0ubpEOJ3XBZ8QkIkb//Cba/hTYLcSnB8Io4WQtUfsnEIsgamlsJT8dkq9lEz+zgPyuPi0ZCJs5CtZ+xPVBgVYd6n29Wv/czgwkl6nSy9RheWLd+PGCD6mAp+1MngR+bvsJsnBYa/1gudHyS3Uz8U9TLvXFhPPKrrNPiSQJkwQ8u7HsuAWuqiu+NzvNoMCCMq5XQ30L2iihHvHrq0Gs9QgncNJEY8/3HhQkYChfU8XHcjyS6VrnC5vhMB9mD+Iswl2I7jjFI+uW/xPQ82yTvWbEcB1wBa4DEY/RwB5P7E0+aWLGGHEXPsDpy1BgCk9AicYFqhCcfyAc+gwEj9wYeJOoG+IHh6Es40AQ7fE3Lhdy/gcEHPI4FHQU8DbRJrUA8tT0qhmBzh9SgAGLzp8kGRP9+kawaCriFocd1Enz3t+zYmyKBVZ/VrM6YXQd22gM6IZOF5Ly1O+U0fjS6gFLXLJ9wToVA/p19yuhBdu8jEiGMErofZj6//yf/KD83gWJU6bxr14g4mAXUqFpsXWlRfRwt0rlChBxZrQVfR1qG8ptBjONrJJRkkkNfP+yw==",3,{"success":16,"message":17,"errorCode":6,"data":6},false,"请先登录哦!",["Reactive",19],{"$ssite-config":20},{"_priority":21,"env":25,"name":26,"url":27},{"name":22,"env":23,"url":24},-10,-15,0,"production","nuxt-app","https://b.itadn.com",["Set"],["ShallowReactive",30],{"$fHfSeYX95Gb6i7b0pKYebZy8EvZavrJ7spzj612vIfB8":6,"$fBWYCX9Fo0KUz04rjB3aG8_QvEcul-JQUtWwucpKu4lA":6},"/i0_12135055815/3398834"]</script> <script>window.__NUXT__={};window.__NUXT__.config={public:{baseURL:"https://b.itadn.com"},app:{baseURL:"/",buildId:"b5740668-9736-4474-bebb-a42cea4f47fd",buildAssetsDir:"/_nuxt/",cdnURL:"https://b.itadn.com"}}</script></body></html>