<?xml version="1.0"?>
<data>
<country name="Liechtenstein">
<rank>1</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor name="Austria" direction="E"/>
<neighbor name="Switzerland" direction="W"/>
</country>
<country name="Singapore">
<rank>4</rank>
<year>2011</year>
<gdppc>59900</gdppc>
<neighbor name="Malaysia" direction="N"/>
</country>
<country name="Panama">
<rank>68</rank>
<year>2011</year>
<gdppc>13600</gdppc>
<neighbor name="Costa Rica" direction="W"/>
<neighbor name="Colombia" direction="E"/>
</country>
</data>
把这个文件保存为sample.xml
其中包含三个种类target ,attribution,element
其中target就是被<>中间的部分 例如<data> <country name="singgapore">中的data ,country。
attri就是name/value对 例如 name="singgapore"
element 就是<> </>中间的部分 例<rank> 68</rank>其中的68就是element 。
使用element处理XML文件的参考下面链接。
本人是第一次使用优快云写,只是把这个当做自己的学习笔记,如果有错误的地方请大家指正。