xml grammar
1.xml document declaration (☆☆☆)
2. define elements (tags) (☆☆☆)
3. defined attributes (☆☆☆)
4. Note (☆☆☆)
5. The special character (☆☆☆)
. 6. CDATA region (☆)
7.PI command (☆)
Document declaration
<?xml version="1.0" encoding="utf-8"?> //注意,必须在第一行,第一列
Define the elements
//只能有一个根标签,其余标签都是它的子标签
//xml会把空格和换行都当成内容来解析 因此,下面这两个元素的含义是不同的
<url>www.cnblogs.com</url>
<url>
www.cnblogs.com
</url>
//标签可以是中文
//xml标签区分大小写
//不能以数字和下划线开头
//不能以xml、Xml、XML开头
//不能包含空格
//不能包含冒号
Defined attributes
//一个标签可以有多个属性
<persson id1="p2" id2="p2"></persson>
//属性名称不能相同
//属性命名规范与元素相同
Note
<!-- 这是xml的注释-->
//注意
xml的注释不可以嵌套使用
Special characters
& ---> &
< ---> <
> ---> >
" ---> "
` ---> '
CDATA area
<![CDATA[需要多次使用转义的内容]]>
eg:if(a<b&&c<d&&d<e)
<![CDATA[if(a<b&&c<d&&d<e)]]>
PI instruction
//在xml中设置样式(没什么用)
<?xml-stylesheet type="text/css" href="css的路径"?>
//对中文标签没有作用