Article Directory
1. What is XML?
- XML refers to extensible markup language (EXtensible Markup Language)
- XML is a markup language, much like HTML
- XML is designed to transmit data rather than displaying data
- XML tags are not predefined. You need to define your own labels.
- XML is designed to be self-descriptive.
- XML is a W3C Recommendation
2. What is the format of a good XML?
2.1 has one and only one root element
<?xml version="1.0" encoding="UTF-8"?>
<persons>
<person pid="p1" sex="男" qq="aaa" parent="p2">
<name>张小明</name>
<age>10</age>
<contact>
<phone>1234567</phone>
</contact>
<br/>
</person>
<person pid="p2">
<name>张大明</name>
<age>35</age>
<contact>
<email>123@qq.com</email>
</contact>
</person>
</persons>
Which persons is one and only one root element.
2.2 XML tags to distinguish the correct case
FIG XML tags as given case sensitive shown perSons.
2.3 nested tags correctly
2.4 legitimate tag name
2.5 valid attribute defined
3, adding the XML DTD declaration
<!DOCTYPE root[]>
//root指的是当前判断的根元素
4, the syntax element defines
<!ELEMENT element-name (type)>
注:根标签也要定义!!!
5, the classification of elements
<!ELEMENT element-name EMPTY>//空元素
<!ELEMENT element-name (#PCDATA)>//文本元素
<!ELEMENT element-name (e1,e2)>//混合元素
6, attribute defined grammar
<!ATTLIST element-name
att_name type
>
attribute
ID
(男|女)
CDATA
IDREF
reference
7, XML is a special symbol
&(逻辑与) &
<(小于) <
>(大于) >
"(双引号) "
'(单引号) '
8, case expansion
Case a legal XML
Case II of DTD elements limit
Case III DTD restrictions on property
Four cases of DTD config.xml restrictions
servlet tag error analysis Case 5 web.xml file