xml dtd 学习小结 By shawl.qiu
以前也有学习XML 的, 不过那时可能是水平不够, 看到DTD 就迷糊了.这次学习 XML - DTD 我发现跟切菜一样容易, 只一天的时间, 感觉已经理解和掌握了 DTD 的用法.
究其原因, 可能要比较充分理解XML之前, 得有WEB编程的服务端与客户端的概念与基础; 理解 DTD, 正则基础则是必需的, 不过N久前, 俺的正则水平就自认为不错了:), 不过那时确实是到 DTD 就卡住了.
这个小结只是总结了尽可能全的 XML DTD 定义例子, 不过 INCLUDE && IGNORE 我还是没理解透.
目录:
xml+dtd 定义实例 By shawl.qiu
1 简单的 xml+dtd
1.1 xml
1.2 css
2 简单的 xml+dtd 1
3 xml+dtd-定义属性
3.1 定义默认属性
3.2 NMTOKEN && NMTOKENS
3.3 ID
3.4 IDREF
3.5 ENTITY && ENTITIES
3.5.0 公式
3.5.0.1 内部带参数 ENTITY
3.5.0.1.1 外部带参数 ENTITY
3.5.1 文本 ENTITY
3.5.2 自定义字符
3.5.3 引用外部文件
3.5.3.1 主文件
3.5.3.2 x13Header.xml
3.5.3.3 x13Footer.xml
3.5.4 带参数 ENTITY
3.5.4.1 内部 带参数 ENTITY
3.5.4.2 外部 带参数 ENTITY
3.5.4.2.1 x15.xml
3.5.4.2.2 x15.dtd
3.6 NOTATION
4 xml+dtd-CDATA
5 xml+dtd-EMPTY-ANY
6 多种方法定义 dtd
7 dtd 子定义
8 dtd 类型混用
9 外部 dtd
9.1 私有 dtd
9.1.1 简单私有 dtd
9.1.1.1 x6.xml
9.1.1.2 x6.dtd
10 xml+dtd-xmlns
10.1 xml+dtd - xmlns 子名称空间
11 INCLUDE && IGNORE
11.0 公式
1.11.1 dtd 定义
shawl.qiu
2006-12-10
http://blog.csdn.net/btbtd
内容:
- xml+dtd 定义实例 By shawl.qiu
- 1 简单的 xml+dtd
- 1.1 xml
- <?xml version="1.0" encoding="UTF-8"?>
- <?xml-stylesheet href="x2.css" type="text/css"?>
- <!DOCTYPE body [
- <!ELEMENT body (blocks)*>
- <!ELEMENT blocks (title, text)>
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- ]>
- <body>
- <blocks>
- <title>title 1</title>
- <text>text 1</text>
- </blocks>
- <blocks>
- <title>title 2</title>
- <text>text 2</text>
- </blocks>
- <blocks>
- <title>title 2</title>
- <text>text 2</text>
- </blocks>
- </body>
- 1.2 css
- /* shawl.qiu CSS Document : shawl.qiu@gmail.com */
- block{background-color:gray;}
- title, text{display:block;}
- title{color:red;}
- text{color:blue;}
- text:first-letter{padding:0px 0px 0px 20px;}
- 2 简单的 xml+dtd 1
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE body [
- <!ELEMENT body (blocks)*>
- <!ELEMENT blocks (title, content) >
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT content (summary, text)*>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- ]>
- <body>
- <blocks>
- <title>this title 1</title>
- <content>
- <summary>summary text</summary>
- <text>the text</text>
- </content>
- </blocks>
- </body>
- 3 xml+dtd-定义属性
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (section)*>
- <!ELEMENT section (title, content)>
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT content (summary, text)>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ATTLIST section id CDATA #REQUIRED>
- <!ATTLIST title id CDATA #IMPLIED>
- <!ATTLIST title xml:lang CDATA #IMPLIED>
- ]>
- <document>
- <section id="ok">
- <title id="hasId" xml:lang="zh-CN" >这是一个测试</title>
- <content>
- <summary></summary>
- <text></text>
- </content>
- </section>
- <section id="no">
- <title xml:lang="en-US">这是一个测试</title>
- <content>
- <summary></summary>
- <text></text>
- </content>
- </section>
- </document>
- 3.1 定义默认属性
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (block)+>
- <!ELEMENT block (id, title, contents, comment?, display)>
- <!ELEMENT id EMPTY>
- <!ATTLIST id
- idArticle CDATA "empty"
- idSpid CDATA "empty"
- idSbid CDATA "empty"
- >
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT contents (summary, text)>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ELEMENT comment (idMsg, nick, msg)>
- <!ATTLIST comment
- switch CDATA #FIXED "on"
- >
- <!ELEMENT idMsg (#PCDATA)>
- <!ELEMENT nick (#PCDATA)>
- <!ELEMENT msg (#PCDATA)>
- <!ELEMENT display EMPTY>
- <!ATTLIST display
- show (yes|no) 'yes'
- >
- <!--枚举属性值-->
- ]>
- <document>
- <block>
- <id/>
- <title/>
- <contents>
- <summary/>
- <text/>
- </contents>
- <comment>
- <idMsg/>
- <nick/>
- <msg/>
- </comment>
- <display />
- </block>
- <block>
- <id idArticle="1" idSpid="1" idSbid="1"/>
- <title/>
- <contents>
- <summary/>
- <text/>
- </contents>
- <comment>
- <idMsg/>
- <nick/>
- <msg/>
- </comment>
- <display show="no" />
- </block>
- </document>
- 3.2 NMTOKEN && NMTOKENS
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (block)+>
- <!ELEMENT block (title, content)>
- <!ELEMENT title (#PCDATA)>
- <!ATTLIST title
- desc NMTOKEN #REQUIRED
- >
- <!ELEMENT content (summary, text)>
- <!ATTLIST content
- about NMTOKENS #IMPLIED
- >
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- ]>
- <document>
- <block>
- <title desc="strictValue">title this</title>
- <content about="could have whitespace">
- <summary>the summary</summary>
- <text>that's text</text>
- </content>
- </block>
- </document>
- 3.3 ID
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (block)+>
- <!ELEMENT block (id, title, content)>
- <!ELEMENT id EMPTY>
- <!ATTLIST id
- val ID #REQUIRED>
- <!ELEMENT title (#PCDATA)>
- <!ATTLIST title
- desc NMTOKEN #REQUIRED
- >
- <!ELEMENT content (summary, text)>
- <!ATTLIST content
- about NMTOKENS #IMPLIED
- >
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- ]>
- <document>
- <block>
- <id val="a1" />
- <title desc="strictValue">title this</title>
- <content about="could have whitespace">
- <summary>the summary</summary>
- <text>that's text</text>
- </content>
- </block>
- <block>
- <id val="a2" />
- <title desc="strictValue">title this</title>
- <content about="could have whitespace">
- <summary>the summary</summary>
- <text>that's text</text>
- </content>
- </block>
- <block>
- <id val="a3" />
- <title desc="strictValue">title this</title>
- <content about="could have whitespace">
- <summary>the summary</summary>
- <text>that's text</text>
- </content>
- </block>
- </document>
- 3.4 IDREF
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE cats [
- <!ELEMENT cats (cat)+>
- <!ELEMENT cat (catSub)+>
- <!ATTLIST cat
- id ID #REQUIRED
- idRef IDREF #IMPLIED
- >
- <!ELEMENT catSub (#PCDATA)>
- ]>
- <cats>
- <cat id='c1' idRef="c2">
- <catSub></catSub>
- <catSub></catSub>
- <catSub></catSub>
- <catSub></catSub>
- </cat>
- <cat id='c2' idRef="c3">
- <catSub></catSub>
- <catSub></catSub>
- <catSub></catSub>
- <catSub></catSub>
- </cat>
- <cat id='c3'>
- <catSub></catSub>
- <catSub></catSub>
- <catSub></catSub>
- <catSub></catSub>
- </cat>
- </cats>
- 3.5 ENTITY && ENTITIES
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (block)+>
- <!ELEMENT block (#PCDATA)>
- <!ENTITY sqCopy SYSTEM 's0.svg'>
- <!ENTITY sqCopy1 SYSTEM 's0.svg'>
- <!ENTITY sqCopy2 SYSTEM 's0.svg'>
- <!ATTLIST block
- sq ENTITY #IMPLIED
- sqs ENTITIES #IMPLIED
- >
- ]>
- <document>
- <block sq="sqCopy">
- </block>
- <block sqs="sqCopy sqCopy1 sqCopy2">
- </block>
- </document>
- 3.5.0 公式
- 3.5.0.1 内部带参数 ENTITY
- <!ENTITY % name definition>
- 3.5.1.1 外部带参数 ENTITY
- <!ENTITY % NAME SYSTEM URI>
- <!ENTITY % NAME PUBLIC FPI URI>
- 3.5.0.1 文本 ENTITY
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (block)+>
- <!ELEMENT block (#PCDATA)>
- <!ENTITY sqCopy1 SYSTEM 's0.svg'>
- <!ENTITY sqCopy2 SYSTEM 's0.svg'>
- <!ENTITY sqCopy '&copy;' >
- <!ATTLIST block
- sq ENTITY #IMPLIED
- sqs ENTITIES #IMPLIED
- >
- ]>
- <document>
- <block sq="sqCopy1">&sqCopy; </block>
- <block sqs="sqCopy1 sqCopy2">
- </block>
- </document>
- 3.5.2 自定义字符
- <?xml version='1.0' encoding='UTF-8'?>
- <!DOCTYPE document [
- <!ELEMENT document (block)+>
- <!ELEMENT block (title, contents)>
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT contents (summary, text)>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ENTITY at '&#64;'>
- <!ENTITY section '&#167;'>
- <!ENTITY yuan '&#165;'>
- <!ENTITY copy '&#169;'>
- <!ENTITY treatmark '&#174;'>
- <!ENTITY euro '&#8364;'>
- ]>
- <document>
- <block>
- <title></title>
- <contents>
- <summary>&yuan; &at; © &treatmark; §ion; €</summary>
- <text></text>
- </contents>
- </block>
- </document>
- 3.5.3 引用外部文件
- 3.5.3.1 主文件
- <?xml version='1.0' encoding='UTF-8'?>
- <!DOCTYPE document [
- <!ELEMENT document (header, block, footer)+>
- <!ELEMENT header (#PCDATA)>
- <!ELEMENT block (title, contents)>
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT contents (summary, text)>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ELEMENT footer (#PCDATA)>
- <!ENTITY header SYSTEM 'x13Header.xml'>
- <!ENTITY footer SYSTEM 'x13Footer.xml'>
- <!ENTITY at '&#64;'>
- <!ENTITY section '&#167;'>
- <!ENTITY yuan '&#165;'>
- <!ENTITY copy '&#169;'>
- <!ENTITY treatmark '&#174;'>
- <!ENTITY euro '&#8364;'>
- ]>
- <document>
- <header>&header; <!--IE Only--></header>
- <block>
- <title></title>
- <contents>
- <summary>&yuan; &at; © &treatmark; §ion; €</summary>
- <text></text>
- </contents>
- </block>
- <footer>&footer; <!--IE Only too--></footer>
- </document>
- 3.5.3.2 x13Header.xml
- <?xml version="1.0" encoding="UTF-8"?>
- 'just a test, and this is header.'
- 3.5.3.3 x13Footer.xml
- <?xml version="1.0" encoding="UTF-8"?>
- 'just a test, and this is footer.'
- 3.5.4 带参数 ENTITY
- 3.5.4.1 内部 带参数 ENTITY
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ENTITY % ct '<!ELEMENT contents (summary, text)>'>
- <!ELEMENT document (block)+>
- <!ELEMENT block (title, contents)>
- <!ELEMENT title (#PCDATA)>
- %ct;
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- ]>
- <document>
- <block>
- <title>the title</title>
- <contents>
- <summary>the summary</summary>
- <text>text go here</text>
- </contents>
- </block>
- </document>
- 3.5.4.2 外部 带参数 ENTITY
- 3.5.4.2.1 x15.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document SYSTEM './x15.dtd'>
- <document>
- <block>
- <title>the title</title>
- <contents>
- <summary>the summary</summary>
- <text>text go here</text>
- </contents>
- <comment xmlns:cmt='http://www.w3c.org/ns/comment/'>
- <cmt:block>
- <cmt:nickname>the name</cmt:nickname>
- <cmt:message>the message</cmt:message>
- </cmt:block>
- </comment>
- </block>
- </document>
- 3.5.4.2.2 x15.dtd
- <?xml version="1.0" encoding="UTF-8"?>
- <!ENTITY % ct '<!ELEMENT contents (summary, text)>'>
- <!ENTITY % cmt '<!ELEMENT comment (cmt:block)+>'>
- <!ELEMENT document (block)+>
- <!ELEMENT block (title, contents, comment?)>
- <!ELEMENT title (#PCDATA)>
- %ct;
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- %cmt;
- <!ATTLIST comment xmlns:cmt CDATA #FIXED 'http://www.w3c.org/ns/comment/'>
- <!ELEMENT cmt:block (cmt:nickname, cmt:message)>
- <!ELEMENT cmt:nickname (#PCDATA)>
- <!ELEMENT cmt:message (#PCDATA)>
- 3.6 NOTATION
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (album)+>
- <!ELEMENT album (subject ,list, description)>
- <!ATTLIST album
- id ID #REQUIRED>
- <!ELEMENT subject (#PCDATA)>
- <!ELEMENT list (img)+>
- <!NOTATION png SYSTEM 'image/png'>
- <!NOTATION jpg SYSTEM 'image/jpeg'>
- <!NOTATION gif SYSTEM 'image/gif'>
- <!NOTATION svg SYSTEM 'image/svg+xml'>
- <!ELEMENT img (#PCDATA)>
- <!ATTLIST img
- sSrc CDATA #IMPLIED
- sType NOTATION (png | jpg | gif | svg) 'svg'
- >
- <!ELEMENT description (#PCDATA)>
- ]>
- <document>
- <album id="a0">
- <subject></subject>
- <list>
- <img sSrc ='s0.svg'>the text</img>
- <img sSrc ='s1.svg'>the text</img>
- <img sSrc ='s2.svg'>the text</img>
- </list>
- <description></description>
- </album>
- <album id="a1">
- <subject></subject>
- <list>
- <img sSrc ='s1.svg'>the text</img>
- <img sSrc ='s2.svg'>the text</img>
- <img sSrc ='s3.svg'>the text</img>
- </list>
- <description></description>
- </album>
- </document>
- 4 xml+dtd-CDATA
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (text)*>
- <!ELEMENT text (#PCDATA)>
- ]>
- <document>
- <text>cdata section
- <![CDATA[
- <!DOCTYPE document [
- <!ELEMENT document (section)*>
- <!ELEMENT section (title, content)>
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT content (summary, text)>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ATTLIST section id CDATA #REQUIRED>
- <!ATTLIST title id CDATA #IMPLIED>
- <!ATTLIST title xml:lang CDATA #IMPLIED>
- ]>
- <document>
- <section id="ok">
- <title id="hasId" xml:lang="zh-CN" >这是一个测试</title>
- <content>
- <summary></summary>
- <text></text>
- </content>
- </section>
- <section id="no">
- <title xml:lang="en-US">这是一个测试</title>
- <content>
- <summary></summary>
- <text></text>
- </content>
- </section>
- </document>
- ]]>
- </text>
- </document>
- 5 xml+dtd-EMPTY-ANY
- <?xml version='1.0' encoding='UTF-8'?>
- <!DOCTYPE document [
- <!ELEMENT document (blocks)*>
- <!ELEMENT blocks (title, content, comment?)>
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT content (summary, text)>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ELEMENT comment EMPTY>
- <!ATTLIST comment date CDATA #IMPLIED>
- ]>
- <document>
- <blocks>
- <title></title>
- <content>
- <summary></summary>
- <text></text>
- </content>
- <comment date='2006/12/09' />
- </blocks>
- <blocks>
- <title></title>
- <content>
- <summary></summary>
- <text></text>
- </content>
- </blocks>
- </document>
- 6 多种方法定义 dtd
- <?xml version='1.0' encoding='UTF-8'?>
- <!DOCTYPE document [
- <!ELEMENT document (block+)>
- <!ELEMENT block (title+, contents*, date?, id)>
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT contents (summary, text)>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ELEMENT date (#PCDATA)>
- <!ELEMENT id (#PCDATA)>
- ]>
- <document>
- <block>
- <title></title>
- <title></title>
- <contents>
- <summary></summary>
- <text></text>
- </contents>
- <id></id>
- </block>
- <block>
- <title></title>
- <date></date>
- <id></id>
- </block>
- </document>
- 7 dtd 子定义
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (block+)>
- <!ELEMENT block (title+, contents*, date?, (id, spid?, sbid*), (adti* | footer?))>
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT contents (summary, text)>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ELEMENT date (#PCDATA)>
- <!ELEMENT id (#PCDATA)>
- <!ELEMENT spid (#PCDATA)>
- <!ELEMENT sbid (#PCDATA)>
- <!ELEMENT adti (#PCDATA)>
- <!ELEMENT footer (#PCDATA)>
- ]>
- <document>
- <block>
- <title/>
- <title/>
- <contents>
- <summary/>
- <text/>
- </contents>
- <id/>
- <spid/>
- <adti/>
- </block>
- <block>
- <title/>
- <date/>
- <id/>
- <footer/>
- </block>
- <block>
- <title/>
- <date/>
- <id/>
- <spid/>
- <sbid/>
- <footer/>
- </block>
- <block>
- <title/>
- <date/>
- <id/>
- <spid/>
- <sbid/>
- </block>
- </document>
- 8 dtd 类型混用
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ELEMENT document (blocks)+ >
- <!ELEMENT blocks (#PCDATA | subele)*>
- <!ELEMENT subele (#PCDATA)>
- ]>
- <document>
- <blocks>okay, test this.</blocks>
- <blocks><subele>test sub element </subele></blocks>
- </document>
- 9 外部 dtd
- 9.1 私有 dtd
- 9.1.1 简单私有 dtd
- 9.1.1.1 x6.xml
- <?xml version="1.0" encoding="UTF-8" standalone='no' ?>
- <!DOCTYPE document SYSTEM './x6.dtd'>
- <document>
- <block>
- <title/>
- <title/>
- <contents>
- <summary/>
- <text/>
- </contents>
- <id/>
- <spid/>
- <adti/>
- </block>
- <block>
- <title/>
- <date/>
- <id/>
- <footer/>
- </block>
- <block>
- <title/>
- <date/>
- <id/>
- <spid/>
- <sbid/>
- <footer/>
- </block>
- <block>
- <title/>
- <date/>
- <id/>
- <spid/>
- <sbid/>
- </block>
- </document>
- 9.1.1.2 x6.dtd
- <!ELEMENT document (block+)>
- <!ELEMENT block (title+, contents*, date?, (id, spid?, sbid*), (adti* | footer?))>
- <!ELEMENT title (#PCDATA)>
- <!ELEMENT contents (summary, text)>
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ELEMENT date (#PCDATA)>
- <!ELEMENT id (#PCDATA)>
- <!ELEMENT spid (#PCDATA)>
- <!ELEMENT sbid (#PCDATA)>
- <!ELEMENT adti (#PCDATA)>
- <!ELEMENT footer (#PCDATA)>
- 10 xml+dtd-xmlns
- <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
- <!DOCTYPE ts:document [
- <!ELEMENT ts:document (ts:block)+>
- <!ATTLIST ts:document xmlns:ts CDATA #FIXED 'http://www.w3c.org/ns/test' >
- <!ELEMENT ts:block (#PCDATA | ts:subele)*>
- <!ELEMENT ts:subele (#PCDATA)>
- ]>
- <ts:document xmlns:ts='http://www.w3c.org/ns/test'>
- <ts:block>just a test</ts:block>
- <ts:block><ts:subele>sub element</ts:subele></ts:block>
- </ts:document>
- 10.1 xml+dtd - xmlns 子名称空间
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE document [
- <!ENTITY % ct '<!ELEMENT contents (summary, text)>'>
- <!ELEMENT document (block)+>
- <!ELEMENT block (title, contents, comment?)>
- <!ELEMENT title (#PCDATA)>
- %ct;
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- <!ELEMENT comment (cmt:block)+>
- <!ATTLIST comment xmlns:cmt CDATA #FIXED 'http://www.w3c.org/ns/comment/'>
- <!ELEMENT cmt:block (cmt:nickname, cmt:message)>
- <!ELEMENT cmt:nickname (#PCDATA)>
- <!ELEMENT cmt:message (#PCDATA)>
- ]>
- <document>
- <block>
- <title>the title</title>
- <contents>
- <summary>the summary</summary>
- <text>text go here</text>
- </contents>
- <comment xmlns:cmt='http://www.w3c.org/ns/comment/'>
- <cmt:block>
- <cmt:nickname>the name</cmt:nickname>
- <cmt:message>the message</cmt:message>
- </cmt:block>
- </comment>
- </block>
- </document>
- 11 INCLUDE && IGNORE
- 11.0 公式
- 11.0.1 INCLUDE
- <![ INCLUDE [DTD Section]]>
- 11.0.2 IGNORE
- <![ IGNORE [DTD Section]]>
- 11.1 dtd 定义
- <?xml version="1.0" encoding="UTF-8"?>
- <![ IGNORE [
- <!ELEMENT text (#PCDATA)>
- <!ELEMENT comment (cmt:block)>
- ]]>
- <![ INCLUDE [
- <!ELEMENT addition (#PCDATA)>
- ]]>
- <!ENTITY % ct '<!ELEMENT contents (summary, text)>'>
- <!ENTITY % cmt '<!ELEMENT comment (cmt:block)+>'>
- <!ELEMENT document (block)+>
- <!ELEMENT block (title, contents, comment?)>
- <!ELEMENT title (#PCDATA)>
- %ct;
- <!ELEMENT summary (#PCDATA)>
- <!ELEMENT text (#PCDATA)>
- %cmt;
- <!ATTLIST comment xmlns:cmt CDATA #FIXED 'http://www.w3c.org/ns/comment/'>
- <!ELEMENT cmt:block (cmt:nickname, cmt:message)>
- <!ELEMENT cmt:nickname (#PCDATA)>
- <!ELEMENT cmt:message (#PCDATA)>