<!DOCTYPE root-element [element-declarations]> |
<?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> |
<!DOCTYPE root-element SYSTEM "filename"> |
<?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> |
<!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> |
<img src="computer.gif" /> |
エンティティー参照 | 文字 |
---|---|
< | < |
> | > |
& | & |
" | " |
' | ' |
<!ELEMENT element-name category> or <!ELEMENT element-name (element-content)> |
<!ELEMENT element-name EMPTY> DTD example:
<!ELEMENT br EMPTY>
XML example:
<br />
<!ELEMENT element-name (#PCDATA)> example: <!ELEMENT note (#PCDATA)> |
<!ELEMENT element-name ANY> example: <!ELEMENT note ANY> |
<!ELEMENT element-name (child-element-name)> or <!ELEMENT element-name (child-element-name,child-element-name,.....)> example: <!ELEMENT note (to,from,heading,body)> |
<!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> |
<!ELEMENT element-name (child-name)> example: <!ELEMENT note (message)> |
<!ELEMENT element-name (child-name+)> example: <!ELEMENT note (message+)> |
<!ELEMENT element-name (child-name*)> example: <!ELEMENT note (message*)> |
example: <!ELEMENT note (to,from,header,message|body)> |
example: <!ELEMENT note (#PCDATA|to|from|header|message)*> |
<!ATTLIST element-name attribute-name attribute-type default-value> example: DTD example: <!ATTLIST payment type CDATA "check"> XML example: <payment type="check"> |
Value | Explanation |
---|---|
CDATA |
The value is character data |
(en1|en2|..) |
The value must be one from an enumerated list |
ID |
The value is a unique id |
IDREF |
The value is the id of another element |
IDREFS |
The value is a list of other ids |
NMTOKEN |
The value is a valid XML name |
NMTOKENS |
The value is a list of valid XML names |
ENTITY |
The value is an entity |
ENTITIES |
The value is a list of entities |
NOTATION |
The value is a name of a notation |
xml: |
The value is a predefined xml value |
Value | Explanation |
---|---|
value |
The attributes default value |
#DEFAULT value |
The attributes default value |
#REQUIRED |
The attribute value must be included in the element |
#IMPLIED |
The attribute does not have to be included |
#FIXED value |
The attribute value is fixed |
DTD example: <!ELEMENT square EMPTY> <!ATTLIST square width CDATA "0"> XML example: <square width="100"></square> |
Syntax: <!ATTLIST element-name attribute-name attribute-type "default-value"> DTD example: <!ATTLIST payment type CDATA "check"> XML example: <payment type="check"> |
Syntax: <!ATTLIST element-name attribute-name attribute-type #IMPLIED> DTD example: <!ATTLIST contact fax CDATA #IMPLIED> XML example: <contact fax="555-667788"> |
Syntax: <!ATTLIST element-name attribute_name attribute-type #REQUIRED> DTD example: <!ATTLIST person number CDATA #REQUIRED> XML example: <person number="5677"> |
Syntax: <!ATTLIST element-name attribute-name attribute-type #FIXED "value"> DTD example: <!ATTLIST sender company CDATA #FIXED "Microsoft"> XML example: <sender company="Microsoft"> |
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"> |
Syntax: <!ENTITY entity-name "entity-value"> DTD Example: <!ENTITY writer "Donald Duck."> <!ENTITY copyright "Copyright W3Schools."> XML example: <author>&writer;©right;</author> |
Syntax: <!ENTITY entity-name SYSTEM "URI/URL"> DTD Example: <!ENTITY writer SYSTEM "http://www.w3schools.com/entities/entities.xml"> <!ENTITY copyright SYSTEM "http://www.w3schools.com/entities/entities.dtd"> XML example: <author>&writer;©right;</author> |