XML Syntax Intrucuction https://www.liquid-technologies.com/XML/
- CDATA
<![CDATA[
if ( a > b ) {
printf("in if : a > b\n");
} else {
printf("in else : a <= b\n");
}
]]>
- Comment
<!-- Single Comment Line -->
<!--
Multiple Coment Part :
line#1
line#2
line#3
-->
- DOCTYPE
Single Layer
<!DOCTYPE note [
<!ENTITY CompanyName 'Liquid Technologies Ltd'>
]>
Multiple Layers
<!DOCTYPE note [
<!ELEMENT body1 (#PCDATA)>
[ innerContent1
<!ELEMENT body2 (#PCDATA)>
[ innerContent2
<!ELEMENT body3 (#PCDATA)>
]
]
]>
- Declaration
<?xml version="1.0" encoding="UTF-8"?>
<?XML version="1.0" encoding="UTF-8"?>
<?xMl version="1.0" encoding="UTF-8"?>
- Process Instruction (PI)
<?stylesheet type="text/xsl" href="/Content/Glossary/main.xsl"?>
<?HeaderName key1="value1" key2="value2" .... ?> // Notes : HeaderName is a must
<Invalid> e.g. !!![ERROR]!!!!
<? key1="value1" key2="value2" .... ?> // Without HeaderName is not allowed
Text For Character References
&# Decimal-Number ; // ';' is a must &#x Hex-Number ; // ';' is a must, 注意,必需是小写的 x, 不能是 大写的 X 注意 : 这些 Code 通常是以 Unicode (UTF-32 bits) 的形式被 XML 解析器所解析的 e.g. <aaa>我们</aaa> // 会显示出 <aaa>我们</aaa> 的字样 e.g.<textForCharacterReferences>aa</textForCharacterReferences>
<!-- These lines are all comment
The above text is "aa" , because ‘a’ = 97(10) =0x61(16)
&# + digit number + ; // decimal mode (10)
&#x + hex number(either A-F or a~f is OK ) + ; // hex mode (16)
-->
在 XML 中,有 5 个预定义的实体引用:
< | < | 小于 |
> | > | 大于 |
& | & | 位 与 |
' | ' | 单引号 |
" | " | 双引号 |
XML 的详细教程文档
https://www.cnblogs.com/cb0327/p/4967782.html
空内容 与 单标签
- 空内容
<aaa></aaa> // 空内容
<aaa>Hello</aaa> // 有内容
- 单标签
Syntax : <tagName /> or <tagName/> e.g.
<?xml version="1.0" encoding="utf-8"?>
<plist version="1.0">
<a>content</a>
<b />
<c/>
</plist>
Namespace of XML:
h:
<table> <name>African Coffee Table</name> <width>80</width> <length>120</length> </table> <h:table> <h:tr> <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr> </h:table>
标签:XML,UTF,--,Syntax,&#,td From: https://www.cnblogs.com/edisonewton/p/18324158