XML是不作为的,仅仅是纯文本,用来存储数据,可以自我表述,可以发明自己的标签
<note>
<to>Georgeto>
<from>Johnfrom>
<heading>Reminderheading>
<body>Don't forget the meeting!body>
note>
所有XML元素都必须有关闭标签,但是不需要声明什么是关闭标签,因为声明不是XML本身的组成部分
XML标签对大小写敏感
必须正确的嵌套,比如是在中打开的,那么他就必须在里面关闭
XML文档必须要用根元素
属性值必须加引号
实体引用,因为直接用<解析器会把它看成新元素的开始
| < | < | 小于 |
|---|---|---|
| > | > | 大于 |
| & | & | 和号 |
| ' | ’ | 单引号 |
| " | " | 引号 |
注释:
用LF存储换行
要避免使用属性,属性必须要加引号,单引号或双引号都可以
因为:
<note date="08/08/2008">
<to>Georgeto>
<from>Johnfrom>
<heading>Reminderheading>
<body>Don't forget the meeting!body>
note>
<note>
<date>08/08/2008date>
<to>Georgeto>
<from>Johnfrom>
<heading>Reminderheading>
<body>Don't forget the meeting!body>
note>
<note>
<date>
<day>08day>
<month>08month>
<year>2008year>
date>
<to>Georgeto>
<from>Johnfrom>
<heading>Reminderheading>
<body>Don't forget the meeting!body>
note>
Don't forget the meeting! ```Reminder