<?xml version="1.0" ?>
<?xml-stylesheet href="xsl/customer.xsl" type="text/xsl" ?>
<famly>
    <father>John</father>
    <mother>Kelly</mother>
    <son>Bill</son>
    <daughter>Joe</daughter>
</family>
<famly>
    <father>Jim</father>
    <mother>Mary</mother>
    <son>Mike</son>
    <daughter>Leo</daughter>
</family>
<famly>
    <father>Wilson</father>
    <mother>Betty</mother>
    <son>Kin</son>
    <daughter>Liza</daughter>
</family>

元素是由开始标签,标签内容,结束标签构成,空元素由空元素标签构成。

根元素:是指其他所有元素都应该在这个元素之中,上图的XML文件是错误的。

元素的命名规范:

名称只能以字母、下划线或者冒号开头;

名称中可以包含字母、数字、下划线及其他在XML标准中允许的字符;

名称中不能包含空格;

名称中尽可能的不要使用冒号(因为冒号是名称空间中被用于分隔名称空间的前缀和本地部分)

名称不能以XML(xml,Xml,xMl)开头

名称的开始标签必须与结束标签一致

 

<father />

 

空标签

 

<famly>
    <father>
        John
    </father>
    <mother>
        Kelly
    </mother>
    <son>
        Bill
    </son>
    <daughter>
        Joe
    </daughter>
</family>

元素的嵌套与元素的并列

元素交叉在XML文件中是不允许的。