日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

DTD教程

 jinzq 2007-04-03

A Document Type Definition defines the legal building blocks of an XML document. It defines the document structure with a list of legal elements.
DTD(文本類型定義)定義了XML文件的合法組建群。它定義了帶有合法元素列表的文件結(jié)構(gòu)。

A DTD can be declared inline in your XML document, or as an external reference.
一份DTD可以在XML文件內(nèi)部聲明或者作為外部參數(shù)聲明。


Internal DOCTYPE declaration
內(nèi)部DOCTYPE聲明

If the DTD is included in your XML source file, it should be wrapped in a DOCTYPE definition with the following syntax:
如果DTD是包含在XML源文件里面的,那么它應(yīng)該預(yù)先包裝在含有以下句法構(gòu)造的DOCTYPE定義當(dāng)中。

<!DOCTYPE root-element [element-declarations]>

Example XML document with a DTD: (Open it in IE5, and select view source):
含有DTD的實(shí)例XML文件:在IE5中把它打開,選擇瀏覽源代碼:

<?xml version="1.0"?>

<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>

<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>

<body>Don‘t forget me this weekend</body>
</note>

The DTD above is interpreted like this:
上面的DTD,如下解釋:

!DOCTYPE note (in line 2) defines that this is a document of the type note.
!DOCTYPE note(在第二行)定義了類型注釋的文件。
!ELEMENT note (in line 3) defines the note element as having four elements: "to,from,heading,body".
!ELEMENT note(第三行)定義了"to,from,heading,body"4個(gè)元素的note元素。
!ELEMENT to (in line 4) defines the to element  to be of the type "#PCDATA".
!ELEMENT to(第4行)解釋說明了成為"#PCDATA"類型之一的to元素。
!ELEMENT from (in line 5) defines the from element to be of the type "#PCDATA"
and so on.....
!ELEMENT from(第5行 )解釋說明了"#PCDATA"等等類型的form元素。

External DOCTYPE declaration
外部DOCTYPE聲明

If the DTD is external to your XML source file, it should be wrapped in a DOCTYPE definition with the following syntax:
如果DTD對于你的XML文件是外部而言,那么它會在含有以下句法構(gòu)造的DOCTYPE聲明中預(yù)先包裝進(jìn)去。

<!DOCTYPE root-element SYSTEM "filename">

This is the same XML document as above, but with an external DTD:  (Open it in IE5, and select view source)
如同上面的,這是份一樣的 XML文件,但是帶有一份外DTD:在IE5中打開,選擇察看源代碼。

<?xml version="1.0"?>

<!DOCTYPE note SYSTEM "note.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>

<body>Don‘t forget me this weekend!</body>
</note>

And this is a copy of the file "note.dtd" containing the DTD:
這是一份包含了DTD的"note.dtd"文件副本。

<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>


Why use a DTD?
為什么要使用DTD?

With DTD, each of your XML files can carry a description of its own format with it.
通過DTD,你的每一個(gè)XML文件都自身攜帶有關(guān)它自身格式的說明。

With a DTD, independent groups of people can agree to use a common DTD for interchanging data.
通過DTD,不同群體的人們可以對使用普通的DTD來交換數(shù)據(jù)的方法達(dá)成一致。

Your application can use a standard DTD to verify that the data you receive from the outside world is valid.
你的應(yīng)用程序可以通過標(biāo)準(zhǔn)的DTD來驗(yàn)證你從正當(dāng)外界接收到的數(shù)據(jù)是有效的。

You can also use a DTD to verify your own data.
你也可以通過DTD來檢驗(yàn)自身的數(shù)據(jù)。



DTD - XML 建立 blocks(二)
/ 2006-09-21

DTD 介紹 DTD - 元素

The main building blocks of both XML and HTML documents are tags like <body>....</body>.
像<body>....</body>之類的標(biāo)簽是XML和HTML文件的主組件群。


The building blocks of XML documents
XML文件的組件群

Seen from a DTD point of view, all XML documents (and HTML documents) are made up by the following simple building blocks:
從DTD來看,所有的XML文件(和HTML文件)都是由接下來的簡單組件群組成的:

  • Elements
    元素
  • Attributes
    屬性
  • Entities
    實(shí)體
  • PCDATA
    被解析的字符數(shù)據(jù)(Parsed Character Data)
  • CDATA
    字符數(shù)據(jù)值(Character Data)

The following is a brief explanation of each of the building blocks:
下面是每個(gè)組件群的簡短解釋。


Elements
元素

Elements are the main building blocks of both XML and HTML documents.
元素是XML和HTML文件的主組件群。

Examples of HTML elements are "body" and "table". Examples of XML elements could be "note" and "message". Elements can contain text, other elements, or be empty. Examples of empty HTML elements are "hr", "br" and "img".
HTML元素的實(shí)例是"body" 和"table"。XML元素實(shí)例是"note" 和"message"。元素可以包括文本、其它元素或者空值??罩礹tml元素的實(shí)例是"hr", "br" 和"img".

Examples:
例如:

<body>body text in between</body>
<message>some message in between</message>


Attributes
屬性

Attributes provide extra information about elements.
屬性提供關(guān)于元素的額外信息。

Attributes are always placed inside the starting tag of an element. Attributes always come in name/value pairs. The following "img" element has additional information about a source file:
屬性總是置于元素的開始標(biāo)簽里面。屬性一般是以“名稱(name)/值(value)”這樣的形勢一對對的出現(xiàn)。下面的“img”元素就是關(guān)于源文件的補(bǔ)充信息:

<img src="computer.gif" />

The name of the element is "img". The name of the attribute is "src". The value of the attribute is "computer.gif". Since the element itself is empty it is closed by a " /".
元素名稱是“img”。屬性名稱“src”。屬性值是"computer.gif"。因?yàn)樵刈陨硎强罩?,所以它是以?”結(jié)束的。


Entities
實(shí)體

Entities are variables used to define common text. Entity references are references to entities.
實(shí)體是對于定義普通文件的變量。實(shí)體參數(shù)是定義實(shí)體的參數(shù)。

Most of you will know the HTML entity reference: " ". This "no-breaking-space" entity is used in HTML to insert an extra space in a document. Entities are expanded when a document is parsed by an XML parser.
很多人都知道HTML實(shí)體參數(shù):" "。這里的"no-breaking-space"實(shí)體是在HTML中用來在文本中插入一個(gè)額外空間的。當(dāng)XML剖析器解析文件時(shí),實(shí)體就會得到擴(kuò)展。

The following entities are predefined in XML:
下面的實(shí)體是在XML中預(yù)定的:

Entity References
實(shí)體參數(shù)
Character
字符
< <
> >
& &
" "
'
 

PCDATA

PCDATA means parsed character data.
PCDATA的意思是被解析的字符數(shù)據(jù)。

Think of character data as the text found between the start tag and the end tag of an XML element.
把字符數(shù)據(jù)當(dāng)作XML元素的開始標(biāo)簽與結(jié)束標(biāo)簽之間的文本。

PCDATA is text that will be parsed by a parser. Tags inside the text will be treated as markup and entities will be expanded. 
剖析器會分析PCDATA文本。文本中的標(biāo)簽會被當(dāng)作標(biāo)示的字體,實(shí)體將會擴(kuò)展。


CDATA

CDATA also means character data.
CDATA也是字符數(shù)據(jù)的意思。

CDATA is text that will NOT be parsed by a parser. Tags inside the text will NOT be treated as markup and entities will not be expanded.
剖析器不會解析CDATA文本。文本中的標(biāo)簽不會作為標(biāo)示字體,實(shí)體也將不會得到擴(kuò)展。



DTD - 元素(三)
/ 2006-09-21

DTD - XML 建立 blocks DTD - 屬性

In a DTD, XML elements are declared with a DTD element declaration.
在DTD中,XML元素是用DTDA元素的聲明方式來聲明的。


Declaring an Element
聲明元素

In the DTD, XML elements are declared with an element declaration. An element declaration has the following syntax:
在DTD中,XML元素是用XML元素的聲明方式來聲明的。元素的聲明方式含有以下句法構(gòu)造:

<!ELEMENT element-name category>
or
<!ELEMENT element-name (element-content)>


Empty elements
空元素

Empty elements are declared with the category keyword EMPTY:
空元素是用類別關(guān)鍵字EMPTY來聲明的:

<!ELEMENT element-name EMPTY>

example:
<!ELEMENT br EMPTY>
XML example:
<br />


Elements with only character data
純字符數(shù)據(jù)的元素

Elements with only character data are declared with #PCDATA inside parentheses:
純字符數(shù)據(jù)的元素用圓括號中的#PCDATA來聲明:

<!ELEMENT element-name (#PCDATA)>

example:
<!ELEMENT from (#PCDATA)>


Elements with any contents
以any內(nèi)容聲明的元素

Elements declared with the category keyword ANY, can contain any combination of parsable data:
以類別關(guān)鍵字ANY聲明的元素能包括任何部分?jǐn)?shù)據(jù)的結(jié)合體。

<!ELEMENT element-name ANY>
example:
<!ELEMENT note ANY>


Elements with children (sequences)
以child關(guān)鍵字聲明的元素(按次序排列)

Elements with one or more children are defined with the name of the children elements inside parentheses:
……包含若干個(gè)子類別的元素用圓括號中的子元素的名字來定義。

<!ELEMENT element-name 
(child-element-name)>
or
<!ELEMENT element-name
(child-element-name,child-element-name,.....)>
example:
<!ELEMENT note (to,from,heading,body)>

When children are declared in a sequence separated by commas, the children must appear in the same sequence in the document. In a full declaration, the children must also be declared, and the children can also have children. The full declaration of the "note" element will be:
當(dāng)子元素被逗號依次隔開聲明時(shí),子元素必須在文件中以相同的順序出現(xiàn)。在一個(gè)完整的聲明中,子元素必須也被聲明,同時(shí)子元素也能有子元素。"note"元素的完整聲明是:

<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>


Declaring only one occurrence of the same element 
給相同的元素聲明一個(gè)發(fā)生事件

<!ELEMENT element-name (child-name)>
example:
<!ELEMENT note (message)>

The example declaration above declares that the child element message must occur once, and only once inside the "note" element.
上面的實(shí)例聲明了子元素信息必須出現(xiàn)一次,并且在"note"元素中只出現(xiàn)一次。


Declaring minimum one occurrence of the same element
聲明相同元素的最小發(fā)生事件

<!ELEMENT element-name (child-name+)>
example:
<!ELEMENT note (message+)>

The + sign in the example above declares that the child element message must occur one or more times inside the "note" element.
上面實(shí)例中的加號聲明了子元素信息必須在"note"元素中出現(xiàn)一次或幾次。


Declaring zero or more occurrences of the same element 
聲明0或更多相同元素的出現(xiàn)事件

<!ELEMENT element-name (child-name*)>
example:
<!ELEMENT note (message*)>

The * sign in the example above declares that the child element message can occur zero or more times inside the "note" element.
在上面實(shí)例中的*號聲明了子元素信息可以在"note"元素中出現(xiàn)0或更多次數(shù)。


Declaring zero or one occurrences of the same element 
聲明0或1次相同元素的發(fā)生事件

<!ELEMENT element-name (child-name?)>
example:
<!ELEMENT note (message?)>

The ? sign in the example above declares that the child element message can occur zero or one times inside the "note" element.
在上面的實(shí)例中的?號聲明了子元素信息可以在"note"元素中出現(xiàn)0或1次。


Declaring either/or content
聲明either/or內(nèi)容

example:
<!ELEMENT note (to,from,header,(message|body))>

The example above declares that the "note" element must contain a "to" element, a "from" element, a "header" element, and either a "message" or a "body" element.
上面的事例聲明了"note"元素必須包含一個(gè)”TO”元素、一個(gè)“form”元素、一個(gè)“header”元素以及“message”或“body”元素。


Declaring mixed content
聲明混合內(nèi)容

example:
<!ELEMENT note (#PCDATA|to|from|header|message)*>
The example above declares that the "note" element can contain zero or more occurrences of parsed character, "to", "from", "header", or "message" elements.
上面的實(shí)例聲明了"note"元素可以包含0或更多分列字符(“or”、“form”、“header”或“message”元素)。




DTD - 屬性(四)
/ 2006-09-21

DTD - 元素 DTD - 實(shí)體

In a DTD, Attributes are declared with an ATTLIST declaration.
在DTD中,屬性是通過ATTLIST聲明來聲明的。


Declaring Attributes
聲明屬性

An attribute declaration has the following syntax:
屬性聲明的語法如下:

<!ATTLIST element-name attribute-name 
attribute-type default-value>
example:
DTD example:
<!ATTLIST payment type CDATA "check">

XML example:
<payment type="check" />

The attribute-type can have the following values:
屬性類型含有以下值:

Value
Explanation
解釋

CDATA

The value is character data
字符數(shù)據(jù)值

(en1|en2|..)

The value must be one from an enumerated list
必須是來自列表中的一個(gè)值

ID

The value is a unique id
唯一獨(dú)立的id值

IDREF

The value is the id of another element
其它元素的id值

IDREFS

The value is a list of other ids
其它id的列表值

NMTOKEN

The value is a valid XML name
其值為一個(gè)有效的XML名稱

NMTOKENS

The value is a list of valid XML names
其值為一組有效的XML名稱列表值

ENTITY

The value is an entity
其值為一個(gè)實(shí)體

ENTITIES

The value is a list of entities
其值為一組實(shí)體的列表

NOTATION

The value is a name of a notation
其值為一個(gè)符號的名稱

xml:

The value is a predefined xml value
預(yù)定的XML值

The default-value can have the following values:
省略補(bǔ)充含有以下值:

Value
Explanation
解釋

value

The default value of the attribute
屬性默認(rèn)值

#REQUIRED

The attribute value must be included in the element
包含于元素內(nèi)的屬性值

#IMPLIED

The attribute does not have to be included
可包含也可不包含于元素內(nèi)

#FIXED value

The attribute value is fixed
固定的屬性值



Specifying a Default attribute value
指定一個(gè)默認(rèn)的屬性值

DTD:
<!ELEMENT square EMPTY>

<!ATTLIST square width CDATA "0">
Valid XML:
<square width="100" />

In the example above, the "square" element is defined to be an empty element with a "width" attribute of  type CDATA. If no width is specified, it has a default value of 0.
在上面的例子中,"square"元素定義為含有CDATA類型的"width"屬性的空元素。如果沒有指定width值,那它默認(rèn)為0。


#IMPLIED

Syntax
語法

<!ATTLIST element-name attribute-name 
attribute-type #IMPLIED>

Example
例子

DTD:
<!ATTLIST contact fax CDATA #IMPLIED>
Valid XML:
<contact fax="555-667788" />
Valid XML:
<contact />

Use the #IMPLIED keyword if you don‘t want to force the author to include an attribute, and you don‘t have an option for a default value.
如果你不想讓author元素包含一個(gè)屬性值或?qū)δJ(rèn)值不具備選擇權(quán),那么你不妨使用#IMPLIED關(guān)鍵字。


#REQUIRED

Syntax
語法

<!ATTLIST element-name attribute_name 
attribute-type #REQUIRED>

Example
例子

DTD:
<!ATTLIST person number CDATA #REQUIRED>
Valid XML:
<person number="5677" />
Invalid XML:

<person />

Use the #REQUIRED keyword if you don‘t have an option for a default value, but still want to force the attribute to be present.
如果你對默認(rèn)值不具備選擇權(quán)卻想?yún)s有想讓屬性值存在,那么你不妨使用#REQUIRED關(guān)鍵字。


#FIXED

Syntax
語法

<!ATTLIST element-name attribute-name 
attribute-type #FIXED "value">

Example
例子

DTD:
<!ATTLIST sender company CDATA #FIXED "Microsoft">
Valid XML:
<sender company="Microsoft" />
Invalid XML:
<sender company="W3Schools" />

Use the #FIXED keyword when you want an attribute to have a fixed value without allowing the author to change it. If an author includes another value, the XML parser will return an error.
當(dāng)你希望屬性是一個(gè)固定值且不希望讓author元素去改變它,我們建議你使用#FIXED關(guān)鍵字。如果author包含另外一個(gè)值,XML剖析器將會提示錯(cuò)誤。


Enumerated attribute values
列舉屬性值方法Enumerated attribute values:

Syntax:
<!ATTLIST element-name
attribute-name (en1|en2|..) default-value>
DTD example:
<!ATTLIST payment type (check|cash) "cash">

XML example:
<payment type="check" />
or
<payment type="cash" />
Use enumerated attribute values when you want the attribute values to be one of a fixed set of legal values.
當(dāng)你希望得到一個(gè)固定合法的屬性值時(shí),請使用列舉屬性值(Enumerated attribute values)的方法。


DTD - 實(shí)體(五)
/ 2006-09-21

DTD - 屬性 DTD 校驗(yàn)

Entities are variables used to define shortcuts to common text.
實(shí)體是用于定義普通文本快捷方式的變量。

- Entity references are references to entities.
實(shí)體參數(shù)就是反映實(shí)體特征的參數(shù)。
- Entities can be declared internal, or external
實(shí)體可以聲明為內(nèi)部實(shí)體或外部實(shí)體。


Internal Entity Declaration
內(nèi)部實(shí)體聲明

Syntax: 
<!ENTITY entity-name "entity-value">

DTD Example:
<!ENTITY writer "Donald Duck.">
<!ENTITY copyright "Copyright W3Schools.">
XML example:
<author>&writer;&copyright;</author>
 

External Entity Declaration
外部實(shí)體聲明

Syntax: 
<!ENTITY entity-name SYSTEM "URI/URL">

DTD Example:
<!ENTITY writer    
SYSTEM "http://www./dtd/entities.dtd">
<!ENTITY copyright
SYSTEM "http://www./dtd/entities.dtd">
XML example:
<author>&writer;&copyright;</author>


Internet Explorer 5.0 can validate your XML against a DTD.
IE5.0可以通過DTD檢驗(yàn)?zāi)愕腦ML。


Validating with the XML Parser
用XML剖析器確認(rèn)

If you try to open an XML document, the XML Parser might generate an error. By accessing the parseError object, the exact error code, the error text, and even the line that caused the error can be retrieved:
如果你想打開一個(gè)XML文件,那XML剖析器會產(chǎn)生錯(cuò)誤。通過訪問分析錯(cuò)誤目標(biāo),精確的錯(cuò)誤代碼、錯(cuò)誤文本以及引起錯(cuò)誤的線路都能找到。

Note: The load( ) method is used for files, while the loadXML( ) method is used for strings.
注意:The load( ) method是用于文件的,而the loadXML( ) method是用于字符串的。

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.validateOnParse="true"

xmlDoc.load("note_dtd_error.xml")

document.write("<br>Error Code: ")
document.write(xmlDoc.parseError.errorCode)
document.write("<br>Error Reason: ")
document.write(xmlDoc.parseError.reason)
document.write("<br>Error Line: ")
document.write(xmlDoc.parseError.line)

你可以自己嘗試一下 或 查看這個(gè)XML文件


Turning Validation off
關(guān)閉確認(rèn)

Validation can be turned off by setting the XML parser‘s validateOnParse="false".
確認(rèn)可以通過XML解析器的validateOnParse="false"來關(guān)閉。

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.validateOnParse="false"

xmlDoc.load("note_dtd_error.xml")

document.write("<br>Error Code: ")
document.write(xmlDoc.parseError.errorCode)
document.write("<br>Error Reason: ")
document.write(xmlDoc.parseError.reason)
document.write("<br>Error Line: ")
document.write(xmlDoc.parseError.line)

自己嘗試一下吧!


A general XML Validator
XML通用的確認(rèn)方法

To help you validate your xml files, we have created this link so that you can Validate any XML file.
如想確認(rèn)你的XML文件,我們創(chuàng)建了一個(gè)可以快速訪問Validate any XML file(確認(rèn)XML文件)的鏈接


The parseError Object
分析錯(cuò)誤對象(Object)

You can read more about the parseError object in our XML DOM tutorial.
如想了解更多關(guān)于parseError 對象的情況,請?jiān)L問我們DOM tutorial (DOM教程)。



DTD - 來自網(wǎng)絡(luò)的舉例(七)
/ 2006-09-21

DTD 校驗(yàn) DTD 摘要

TV Schedule DTD
DTD電視節(jié)目

By David Moisan. Copied from his Web: http://www./
摘自網(wǎng)絡(luò) http://www./

<!DOCTYPE TVSCHEDULE [
<!ELEMENT TVSCHEDULE (CHANNEL+)>
<!ELEMENT CHANNEL (BANNER,DAY+)>
<!ELEMENT BANNER (#PCDATA)>
<!ELEMENT DAY (DATE,(HOLIDAY|PROGRAMSLOT+)+)>
<!ELEMENT HOLIDAY (#PCDATA)>
<!ELEMENT DATE (#PCDATA)>

<!ELEMENT PROGRAMSLOT (TIME,TITLE,DESCRIPTION?)>
<!ELEMENT TIME (#PCDATA)>
<!ELEMENT TITLE (#PCDATA)> 
<!ELEMENT DESCRIPTION (#PCDATA)>

<!ATTLIST TVSCHEDULE NAME CDATA #REQUIRED>
<!ATTLIST CHANNEL CHAN CDATA #REQUIRED>
<!ATTLIST PROGRAMSLOT VTR CDATA #IMPLIED>
<!ATTLIST TITLE RATING CDATA #IMPLIED>

<!ATTLIST TITLE LANGUAGE CDATA #IMPLIED>

]>
 

Newspaper Article DTD
DTD報(bào)紙文摘

Copied from http://www./ 
Copied from (摘自)http://www./

<!DOCTYPE NEWSPAPER [ 
<!ELEMENT NEWSPAPER (ARTICLE+)>
<!ELEMENT ARTICLE (HEADLINE,BYLINE,LEAD,BODY,NOTES)>
<!ELEMENT HEADLINE (#PCDATA)>
<!ELEMENT BYLINE (#PCDATA)>

<!ELEMENT LEAD (#PCDATA)>
<!ELEMENT BODY (#PCDATA)>
<!ELEMENT NOTES (#PCDATA)> 
<!ATTLIST ARTICLE AUTHOR CDATA #REQUIRED>
<!ATTLIST ARTICLE EDITOR CDATA #IMPLIED>
<!ATTLIST ARTICLE DATE CDATA #IMPLIED>
<!ATTLIST ARTICLE EDITION CDATA #IMPLIED>
<!ENTITY NEWSPAPER "Vervet Logic Times">

<!ENTITY PUBLISHER "Vervet Logic Press">
<!ENTITY COPYRIGHT "Copyright 1998 Vervet Logic Press">
]>
 

Product Catalog DTD
DTD產(chǎn)品目錄

Copied from http://www./ 
Copied from (摘自)http://www./

<!DOCTYPE CATALOG [
<!ENTITY AUTHOR "John Doe">

<!ENTITY COMPANY "JD Power Tools, Inc.">
<!ENTITY EMAIL "jd@jd-tools.com">

<!ELEMENT CATALOG (PRODUCT+)>

<!ELEMENT PRODUCT
(SPECIFICATIONS+,OPTIONS?,PRICE+,NOTES?)>
<!ATTLIST PRODUCT
NAME CDATA #IMPLIED
CATEGORY (HandTool|Table|Shop-Professional) "HandTool"
PARTNUM CDATA #IMPLIED
PLANT (Pittsburgh|Milwaukee|Chicago) "Chicago"

INVENTORY (InStock|Backordered|Discontinued) "InStock">

<!ELEMENT SPECIFICATIONS (#PCDATA)>
<!ATTLIST SPECIFICATIONS
WEIGHT CDATA #IMPLIED
POWER CDATA #IMPLIED>

<!ELEMENT OPTIONS (#PCDATA)>
<!ATTLIST OPTIONS
FINISH (Metal|Polished|Matte) "Matte"
ADAPTER (Included|Optional|NotApplicable) "Included"

CASE (HardShell|Soft|NotApplicable) "HardShell">

<!ELEMENT PRICE (#PCDATA)>
<!ATTLIST PRICE
MSRP CDATA #IMPLIED
WHOLESALE CDATA #IMPLIED
STREET CDATA #IMPLIED
SHIPPING CDATA #IMPLIED>

<!ELEMENT NOTES (#PCDATA)>

]>
 

DTD 摘要(八)
/ 2006-09-21

DTD - 來自網(wǎng)絡(luò)的舉例

DTD Summary
DTD概要

This tutorial has taught you how to describe the structure of an XML document.
這份教程是說明XML文件結(jié)構(gòu)的

You have learned how to use a DTD to define the legal elements of an XML document, and how the DTD can be declared inside your XML document, or as an external reference.
你已經(jīng)知道了如何使用DTD來定義XML文件中的合法元素,以及如何將DTD從你的XML文件中或?qū)⑵渥鳛橥獠繀?shù)來聲明。

You have learned how to declare the legal elements, attributes, entities, and CDATA sections for XML documents.
你已經(jīng)知道了如何來聲明合法元素,屬性,實(shí)體以及XML文件的CDATA部分。

You have also seen how to validate an XML document against a DTD.
你也知道了如何通過DTD來驗(yàn)證XML文件。


Now You Know DTD, What‘s Next?
現(xiàn)在你知道了DTD,那接下來該如何做呢?

The next step is to learn about XML Schema.
下一步是了解XML計(jì)劃。

XML Schema is used to define the legal elements of an XML document, just like a DTD. We think that very soon XML Schemas will be used in most Web applications as a replacement for DTDs.
XML計(jì)劃是用于定義XML文件中像DTD的合法元素的。我們來想一想不久XML計(jì)劃將會用于更多諸如代替DTD的網(wǎng)絡(luò)應(yīng)用軟件。

XML Schema is an XML-based alternative to DTD.
XML 計(jì)劃對于DTD來說是一種以XML為基礎(chǔ)的可供選擇的辦法。

Unlike DTD, XML Schemas has support for data types and namespaces.
不像DTD,XML計(jì)劃支持?jǐn)?shù)據(jù)類型和命名空間。

If you want to learn more about XML Schema, please visit our XML Schema tutorial.
如果你想了解更多XML計(jì)劃,請?jiān)L問我們的XML Schema tutorial. (XML計(jì)劃教程)。

網(wǎng)址:http://www.

    本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多