DTD (DocType Declaration) in one page | |||||||||||||||||||||||||||||||||||||||
Contents: Review: DOCTYPE Declaration & DTDs, DTD Example; Declarations: ELEMENT Type Declaration, ATTLIST Declaration, ENTITY Declaration, NOTATION Declaration, Conditonal Section; Other: DTD Guide Glossary, Related References (Review, Documentation, etc.), Related themes, Miscellaneous. |
|||||||||||||||||||||||||||||||||||||||
DTD Example | |||||||||||||||||||||||||||||||||||||||
XML example:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!ELEMENT element_0 (element_1, element_2, element_3, element_4, element_5)> |
|||||||||||||||||||||||||||||||||||||||
DOCTYPE Declaration & DTDs | |||||||||||||||||||||||||||||||||||||||
The document type (DOCTYPE) declaration consists of an internal, or references an external Document Type Definition (DTD). It can also have a combination of both internal and external DTDs. The DTD defines the constraints on the structure of an XML document. It declares all of the document's element typesglossary, children element types, and the order and number of each element type. It also declares any attributes, entities, notations, processing instructions, comments, and PE references in the document. A document can use both internal and external DTD subsets. The internal DTD subset is specified between the square brackets of the DOCTYPE declaration. The declaration for the external DTD subset is placed before the square brackets immediately after the SYSTEM keyword. |
|||||||||||||||||||||||||||||||||||||||
The Internal DTD: <!DOCTYPE root_element [ Document Type Definition (DTD): elements/attributes/entities/notations/ processing instructions/comments/PE references ]> |
Rules:
|
||||||||||||||||||||||||||||||||||||||
"Private" External DTDs: <!DOCTYPE root_element SYSTEM "DTD_location"> |
External DTDs are useful for creating a common DTD that can be shared between multiple documents. Any changes that are made to the external DTD automatically updates all the documents that reference it. There are two types of external DTDs: private, and public. Private external DTDs are identified by the keyword SYSTEM, and are intended for use by a single author or group of authors. Public external DTDs are identified by the keyword PUBLIC and are intended for broad use. The "DTD_location" is used to find the public DTD if it cannot be located by the "DTD_name". Rules:
DTD_location: relative or absolute URL
|
||||||||||||||||||||||||||||||||||||||
"Public" External DTDs: <!DOCTYPE root_element PUBLIC "DTD_name" "DTD_location"> |
|||||||||||||||||||||||||||||||||||||||
ELEMENT Type Declaration | ATTLIST Declaration | ||||||||||||||||||||||||||||||||||||||
Element type declarations set the rules for the type and number of elements that may appear in an XML document, what elements may appear inside each other, and what order they must appear in. |
Attributes are additional information associated with an element typeglossary. They are intended for interpretation by an application. The ATTLIST declarations identify which element types may have attributes, what type of attributes they may be, and what the default value of the attributes are. |
||||||||||||||||||||||||||||||||||||||
<!ELEMENT name_element allowable_contents> |
Rules:
|
<!ELEMENT foo (#PCDATA)> | |||||||||||||||||||||||||||||||||||||
<!ELEMENT img EMPTY> | <!ATTLIST element_name attribute_name attribute_type default_value> |
element_name: name of the element to which the attribute applies. Rules:
Note:
|
<?xml version="1.0"?> <!DOCTYPE image [ <!ELEMENT image EMPTY> <!ATTLIST image height CDATA #REQUIRED> <!ATTLIST image width CDATA #REQUIRED> ]> <image height="32" width="32"/> |
||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||
<!ELEMENT ELEMENT element_name EMPTY> |
Declaring Empty Elements: |
<?xml version="1.0"?> <!DOCTYPE student [ <!ELEMENT br EMPTY> ]> <br /> <br></br> |
|||||||||||||||||||||||||||||||||||||
<!ELEMENT element_name (#PCDATA)> |
Declaring Elements With Only Character Data: |
<?xml version="1.0"?> <!DOCTYPE student [ <!ELEMENT country (#PCDATA)> ]> <country>USA</country> |
|||||||||||||||||||||||||||||||||||||
<!ELEMENT element_name ANY> |
Declaring Elements With Any Contents: |
<?xml version="1.0"?> <!DOCTYPE student [ <!!ELEMENT note ANY> <!ELEMENT title (#PCDATA)> ]> <note>Manual <title>DTD</title></note> |
|||||||||||||||||||||||||||||||||||||
The "default_value" signifies whether an attribute is required or not, and if not, what default value should be displayed. The possible default values are listed in below. | |||||||||||||||||||||||||||||||||||||||
<!ELEMENT parent_name (child_name)> <!ELEMENT child_name allowable_contents> |
Declaring Children:
|
<?xml version="1.0"?> <!DOCTYPE student [ <!--'student' must have one child element type 'id'--> <!ELEMENT student (id)> <!--'id' may only contain text that is not markup in its content--> <!ELEMENT id (#PCDATA)> ]> <student><id>9216735</id></student> |
|||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||
<!ELEMENT parent_name (child1_name,child2_name,child3_name)> <!ELEMENT child1_name allowable_contents> <!ELEMENT child2_name allowable_contents> <!ELEMENT child3_name allowable_contents> |
Declaring Multiple Children (Sequence):
|
<?xml version="1.0"?> <!DOCTYPE student [ <!--'student' must contain three child elements in the order listed--> <!ELEMENT student (id,surname,firstname)> <!--the elements listed below may only contain text that is not markup--> <!ELEMENT id (#PCDATA)> <!ELEMENT firstname (#PCDATA)> <!ELEMENT surname (#PCDATA)> ]>> <student> <id>9216735</id> <surname>Smith</surname> <firstname>Jo</firstname> </student> |
|
||||||||||||||||||||||||||||||||||||
CDATA Example: | ID Example: | IDREF Example: | |||||||||||||||||||||||||||||||||||||
<?xml version="1.0"?> <!DOCTYPE image [ <!ELEMENT image EMPTY> <!ATTLIST image height CDATA #REQUIRED> <!ATTLIST image width CDATA #REQUIRED> ]> <image height="32" width="32"/> |
<?xml version="1.0"?> <!DOCTYPE student_name [ <!ELEMENT student_name (#PCDATA)> <!ATTLIST student_name student_no ID #REQUIRED> ]> <student_name student_no="a9216735"> Jo Smith </student_name> |
<?xml version="1.0" standalone="yes"?> <!DOCTYPE lab_group [ <!ELEMENT lab_group (student_name)*> <!ELEMENT student_name (#PCDATA)> <!ATTLIST student_name student_no ID #REQUIRED> <!ATTLIST student_name tutor_1 IDREF #IMPLIED> <!ATTLIST student_name tutor_2 IDREF #IMPLIED> ]> <lab_group> <student_name student_no="a8904885">Alex Foo</student_name> <student_name student_no="a9011133">Sarah Bar</student_name> <student_name student_no="a9216735" tutor_1="a9011133" tutor_2="a8904885">Jo Smith</student_name> </lab_group> |
|||||||||||||||||||||||||||||||||||||
<!ELEMENT parent_name (child_name?)> <!ELEMENT child's_name allowable_contents> |
Declaring Optional Children:
|
<?xml version="1.0"?> <!DOCTYPE student [ <!--'student' can have zero or one child element of type 'dob'--> <!ELEMENT student (dob?)> <!--'dob' may only contain text that is not markup in its content--> <!ELEMENT dob (#PCDATA)> ]> <student><dob>19.06.74</dob></student> |
|||||||||||||||||||||||||||||||||||||
ENTITY Example: | ENTITIES Example: | ||||||||||||||||||||||||||||||||||||||
<?xml version="1.0" standalone="no"?> <!DOCTYPE experiment_a [ <!ELEMENT experiment_a (results)*> <!ELEMENT results EMPTY> <!ATTLIST results image ENTITY #REQUIRED> <!ENTITY a SYSTEM "http://www.xml.su/dtd.gif"> ]> <experiment_a> <results image="a"/> <experiment_a> |
<?xml version="1.0" standalone="no"?> <!DOCTYPE experiment_a [ <!ELEMENT experiment_a (results)*> <!ELEMENT results EMPTY> <!ATTLIST results images ENTITIES #REQUIRED> <!ENTITY a1 SYSTEM "http://www.xml.su/dtd_1.gif"> <!ENTITY a2 SYSTEM "http://www.xml.su/dtd_2.gif"> <!ENTITY a3 SYSTEM "http://www.xml.su/dtd_3.gif"> ]> <experiment_a> <results images="a1 a2 a3"/> </experiment_a> |
||||||||||||||||||||||||||||||||||||||
<!ELEMENT parent_name (child_name*)> <!ELEMENT child_name allowable_contents> |
Declaring Zero or More Children:
|
<?xml version="1.0"?> <!DOCTYPE student [ <!--'student' can have zero or more child elements of type 'subject'--> <!ELEMENT student (subject*)> <!--'subject' may only contain text that is not markup in its content--> <!ELEMENT subject (#PCDATA)> ]> <student> <subject>Mathematics</subject> <subject>Physics</subject> <subject>Chemistry</subject> </student> |
|||||||||||||||||||||||||||||||||||||
NMTOKEN Example: | |||||||||||||||||||||||||||||||||||||||
<?xml version="1.0"?> <!DOCTYPE student_name [ <!ELEMENT student_name (#PCDATA)> <!ATTLIST student_name student_no NMTOKEN #REQUIRED> ]> <student_name student_no="9216735"> Jo Smith </student_name> |
|||||||||||||||||||||||||||||||||||||||
NOTATION Example: | |||||||||||||||||||||||||||||||||||||||
<?xml version="1.0"?> <!DOCTYPE code [ <!ELEMENT code (#PCDATA)> <!NOTATION vrml PUBLIC "VRML 1.0"> <!ATTLIST code lang NOTATION (vrml) #REQUIRED> ]> <code lang="vrml"> Some VRML instructions </code> |
|||||||||||||||||||||||||||||||||||||||
Enumerated Example: | |||||||||||||||||||||||||||||||||||||||
<?xml version="1.0"?> <!DOCTYPE ToDoList [ <!ELEMENT ToDoList (task)*> <!ELEMENT task (#PCDATA)> <!ATTLIST task status (important|normal) #REQUIRED> ]> <ToDoList> <task status="important">This is an important task that must be completed</task> <task status="normal">This task can wait</task> </ToDoList> |
|||||||||||||||||||||||||||||||||||||||
<!ELEMENT parent_name (child_name+)> <!ELEMENT child_name allowable_contents> |
Declaring One or More Children:
|
<?xml version="1.0"?> <!DOCTYPE student [ <!--'student' must have at least one child element of type 'subject'--> <!ELEMENT student (subject+)> <!--'subject' may only contain text that is not markup in its content--> <!ELEMENT subject (#PCDATA)> ]> <student><subject>Mathematics</subject></student> |
Predefined Attributes Example: | ||||||||||||||||||||||||||||||||||||
<?xml version="1.0" standalone="yes"?> <!DOCTYPE document [ <!ELEMENT document (description,code)> <!ELEMENT description (#PCDATA)> <!ATTLIST description xml:lang NMTOKEN #FIXED "en"> <!ELEMENT code (#PCDATA)> <!ATTLIST code xml:space (default|preserve) "preserve"> ]> <document> <description xml:lang="en"> The following section of code displays the menu of user choices and gets the user's request. </description> <code> do { do { disp_menu(); scanf(" %d", &ans); } while ((ans<1) || (ans>3)); }; </code> </document> |
|||||||||||||||||||||||||||||||||||||||
Default Value Example 1: | |||||||||||||||||||||||||||||||||||||||
<?xml version="1.0"?> <!DOCTYPE ToDoList [ <!ELEMENT ToDoList (task)*> <!ELEMENT task (#PCDATA)> <!ATTLIST task status (important|normal) "normal"> ]> <ToDoList> <task status="important">This is an important task.</task> <task>This is by default a task that has a normal status.</task> </ToDoList> |
|||||||||||||||||||||||||||||||||||||||
<!ELEMENT parent_name (child1_name|child2_name)> <!ELEMENT child1_name allowable_contents> <!ELEMENT child2_name allowable_contents> |
Combinations of Children (Choice):
|
<?xml version="1.0"?> <!DOCTYPE student [ <!--'student' must have 'id' or 'surname' as its child element--> <!ELEMENT student (id|surname)> <!--the elements listed below may only contain text that is not markup--> <!ELEMENT id (#PCDATA)> <!ELEMENT surname (#PCDATA)> ]> <student><id>9216735</id></student> |
Default Value Example 2: | ||||||||||||||||||||||||||||||||||||
<?xml version="1.0"?> <!DOCTYPE ToDoList [ <!ELEMENT ToDoList (task)*> <!ELEMENT task (#PCDATA)> <!ATTLIST task status NMTOKEN #FIXED "monthly"> ]> <ToDoList> <task>go to the bank</task> <task>pay the phone bill</task> </ToDoList> |
|||||||||||||||||||||||||||||||||||||||
<!!ELEMENT parent_name (#PCDATA|child1_name)*> |
Mixed Content:
|
Example 1: <?xml version="1.0"?> <!DOCTYPE student [ <!ELEMENT student (#PCDATA|id)*> <!ELEMENT id (#PCDATA)> ]> <student> Here's a bit of text mixed up with the child element. <id>9216735</id> You can put text anywhere, before or after the child element. You don't even have to include the 'id' element. </student> Example 2: <?xml version="1.0"?> <!DOCTYPE student [ <!ELEMENT student (#PCDATA|id|surname|dob)*> <!ELEMENT id (#PCDATA)> <!ELEMENT surname (#PCDATA)> ]> <student> You can put text anywhere. You can also put the elements in any order in the document. <surname>Smith</surname> And, you don't have to include all the elements listed in the element declaration. <id>9216735</id> </student> |
|||||||||||||||||||||||||||||||||||||
#IMPLIED Example: | #REQUIRED Example: | #FIXED Example: | |||||||||||||||||||||||||||||||||||||
<?xml version="1.0"?> <!DOCTYPE contacts [ <!ELEMENT contact EMPTY> <!ATTLIST contact fax CDATA #IMPLIED)> ]> <contacts> <--Valid XML:--> <contact fax="555-667788" /> <--Valid XML:--> <contact /> </contacts> |
<?xml version="1.0"?> <!DOCTYPE contacts [ <!ELEMENT contact EMPTY> <!ATTLIST person number CDATA #REQUIRED> ]> <contacts> <--Valid XML:--> <person number="5677" /> <--Invalid XML: <person /> --> </contacts> |
<?xml version="1.0"?> <!DOCTYPE contacts [ <!ELEMENT contact EMPTY> <!ATTLIST sender company CDATA #FIXED "IBM"> ]> <contacts> <--Valid XML:--> <sender company="IBM" /> <--Invalid XML: <sender company="Microsoft" /> --> </contacts> |
|||||||||||||||||||||||||||||||||||||
ENTITY Declaration | |||||||||||||||||||||||||||||||||||||||
Entities reference data that act as an abbreviation or can be found at an external location. Entities help to reduce the entry of repetitive information and also allow for easier editing (by reducing the number of occurrences of data to edit). There are two types of entity declarations: GENERAL entity declarations, and PARAMETER entity declarations. | |||||||||||||||||||||||||||||||||||||||
The types of general entities include:
|
The types of parameter entities include:
|
||||||||||||||||||||||||||||||||||||||
<!ENTITY name "entity_value"> |
INTERNAL (PARSED) GENERAL ENTITY Declaration: Internal parsed entities generally reference text. The correct definition is that they refer to data that an XML processor has to parse. entity_value: any character that is not an '&', '%' or ' " ', a parameter entity reference ('%Name;'), an entity reference ('&Name;') or a Unicodeglossary character reference. |
<?xml version="1.0" standalone="yes" ?> <!DOCTYPE author [ <!ELEMENT author (#PCDATA)> <!ENTITY js "Jo Smith"> ]> <author>&js;</author> |
|||||||||||||||||||||||||||||||||||||
NOTATION Declaration | |||||||||||||||||||||||||||||||||||||||
<!NOTATION name SYSTEM "URI"> <!NOTATION name PUBLIC "public_ID"> <!NOTATION name PUBLIC "public_ID" "URI"> |
NOTATIONS are used to identify the format of unparsed entities (non-XML data),
elements with a notation attribute, or specific processing instructions.
|
Unparsed Entity Example:
<?xml version="1.0" standalone="no" ?>
<?xml version="1.0"?> |
|||||||||||||||||||||||||||||||||||||
<!ENTITY name SYSTEM "URI"> <!ENTITY name PUBLIC "public_ID" "URI"> |
EXTERNAL (PARSED) GENERAL ENTITY Declaration:
External parsed entities generally reference text. The correct definition is that they refer to data that an XML processor has to parse.
External entities are useful for creating a common reference that can be shared between multiple documents.
Any changes that are made to external entities are automatically updated in the documents they are referenced.
There are two types of external entities: private, and public.
Private external entities are identified by the keyword SYSTEM, and are intended for use by a single author or group of authors.
Public external entities are identified by the keyword PUBLIC and are intended for broad use.
|
Example 1:
<?xml version="1.0" standalone="no" ?><!DOCTYPE copyright [ <!ELEMENT copyright (#PCDATA)> <!ENTITY c SYSTEM "http://www.xml.sut/copyright.xml"> ]> <copyright>&c;</copyright> Example 2:
<?xml version="1.0" standalone="no" ?><!DOCTYPE copyright [ <!ELEMENT copyright (#PCDATA)> <!ENTITY c PUBLIC "-//W3C//TEXT copyright//EN" "http://www.w3.org/xmlspec/copyright.xml"> ]> <copyright>&c;</copyright> |
|||||||||||||||||||||||||||||||||||||
Conditonal Section | |||||||||||||||||||||||||||||||||||||||
<![ IGNORE [ markup declarations ]]> <![ INCLUDE [ markup declarations ]]> |
A way of including or excluding sections in the DTD is to use conditional sections.
Conditional sections are of most use when linked to a parameter entity reference, and may only be used in an external DTD subset.
The two conditional section statements are IGNORE and INCLUDE. Rules:
|
<!ENTITY % draft "INCLUDE"> <!ENTITY % final "IGNORE"> <![%draft;[ <!ELEMENT book (title,author,summary)> ]]> <![%final;[ <!ELEMENT book (comments*,title,author,summary)> ]]> <!ELEMENT comments (#PCDATA)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT summary (#PCDATA)> |
|||||||||||||||||||||||||||||||||||||
<!ENTITY name SYSTEM "URI" NDATA name> <!ENTITY name PUBLIC "public_ID" "URI" NDATA name"> |
EXTERNAL (UNPARSED) GENERAL ENTITY Declaration:
External unparsed entities generally reference non-XML data. The 100% correct definition is that they refer to data that an XML processor does not have to parse.
|
Example 1:
<?xml version="1.0" standalone="no" ?><!DOCTYPE img [ <!ELEMENT img EMPTY> <!ATTLIST img src ENTITY #REQUIRED> <!ENTITY logo SYSTEM "http://www.xml.su/logo.gif" NDATA gif> <!NOTATION gif PUBLIC "gif viewer"> ]> <img src="logo"/> Example 2:
<?xml version="1.0" standalone="no" ?><!DOCTYPE img [ <!ELEMENT img EMPTY> <!ATTLIST img src ENTITY #REQUIRED> <!ENTITY logo PUBLIC "-//W3C//GIF logo//EN" "http://www.w3.org/logo.gif" NDATA gif> <!NOTATION gif PUBLIC "gif viewer"> ]> <img src="logo"/> |
|||||||||||||||||||||||||||||||||||||
DTD Guide Glossary | |||||||||||||||||||||||||||||||||||||||
application | A self-contained program that performs a specific function directly for the user. An example of an application is XMLwriter. It is a standalone program that allows you to edit XML files as well as other text files. | ||||||||||||||||||||||||||||||||||||||
<!ENTITY % name "entity_value"> |
INTERNAL (PARSED) PARAMETER ENTITY Declaration:
Internal parameter entity references are used to declare entities existing only in the DTD.
|
Example 1: <!--external DTD example--> <!ENTITY % p "(#PCDATA)"> <!ELEMENT student (id,surname,firstname,dob,(subject)*)> <!ELEMENT id %p;> <!ELEMENT surname %p;> <!ELEMENT firstname %p;> <!ELEMENT dob %p;> <!ELEMENT subject %p;> Example 2:
<!--external DTD example--><!ELEMENT author (#PCDATA)> <!ENTITY % js "Jo Smith"> <!--note that the general entity statement below is used to reference a parameter entity--> <!ENTITY wb "written by %js;"> Example 3:
<!--external DTD example--><!ENTITY % info "(id,surname,firstname)"> <!ELEMENT lab_group_A %info;> <!ELEMENT lab_group_B %info;> <!ELEMENT lab_group_C %info;> |
|||||||||||||||||||||||||||||||||||||
attribute | Attributes are inserted in start or empty element tags in the form attribute_name="attribute_value". They are additional information about an element, intended for interpretation by an application. An example of an attribute is <img src="logo.gif"/>, where src is the attribute_name, and logo.gif is the attribute_value. | ||||||||||||||||||||||||||||||||||||||
attribute-list (ATTLIST) declaration | Attribute-list declarations are placed inside a DTD. They specify what attributes are allowed in an XML document, to which element they belong, and what the default value of an attribute may be. An example of an ATTLIST declaration is <!ATTLIST img src EMPTY>. | ||||||||||||||||||||||||||||||||||||||
CDATA | Character data, or text that does not need to be parsed. Markup within CDATA sections will not be interpreted as markup. | ||||||||||||||||||||||||||||||||||||||
child element | An element nested inside another (parent) element. For example: <parent_element> <child_element> </child_element> </parent_element> |
||||||||||||||||||||||||||||||||||||||
document type (DOCTYPE) declaration | Used to contain an internal DTD, or point to an external DTD. | ||||||||||||||||||||||||||||||||||||||
Document Type Definition | A set of rules describing the structure of an XML document. The document must conform to these rules in order to be valid. | ||||||||||||||||||||||||||||||||||||||
DTD | See Document Type Definition. | ||||||||||||||||||||||||||||||||||||||
empty tag | An element that has no content. In XML, an empty tag follows the syntax: <name></name> or <name/>. | ||||||||||||||||||||||||||||||||||||||
end tag | The closing tag of an element. It follows the syntax: </name>, and must match the name in the start tag to be well-formed XML. | ||||||||||||||||||||||||||||||||||||||
element type | The name that appears in a start, end or empty tag.
In the following example there are three elements but only two element types: <scholar> <sex>girl</sex> <sex>boy</sex> </scholar> |
<!ENTITY % name SYSTEM "URI"> %name; <!ENTITY % name PUBLIC "public_ID" "URI""> %name; |
EXTERNAL (PARSED) PARAMETER ENTITY Declaration: External parameter entity references are used to link external DTDs. There are two types of external entities: private, and public. Private external entities are identified by the keyword SYSTEM, and are intended for use by a single author or group of authors. Public external entities are identified by the keyword PUBLIC and are intended for broad use.
|
<?xml version="1.0" standalone="no"?> <!DOCTYPE student [ <!ENTITY % student SYSTEM "http://www.university.com/student.dtd"> %student; ]> |
|||||||||||||||||||||||||||||||||||
ELEMENT type declaration | Element type declarations are placed inside a DTD. They specify what elements are allowed in an XML document, and what their content may be. An example of an ELEMENT declaration is <!ELEMENT student (id,surname)>. | ||||||||||||||||||||||||||||||||||||||
ENTITY declaration | Entity declarations are placed inside a DTD. They contain the abbreviation to be used for an entity, and the text to be substituted for that abbreviation. They may also contain a URI if the text or data is stored at a remote location. An example of an ENTITY declaration is <!ENTITY js "Jo Smith">. | ||||||||||||||||||||||||||||||||||||||
external DTD | A DTD that is contained in another file which may reside at a remote location. | ||||||||||||||||||||||||||||||||||||||
general entity reference | An entity used in the content of an XML document. General entities follow the syntax '&name;'. | ||||||||||||||||||||||||||||||||||||||
internal DTD | A DTD that is located within the XML document. | ||||||||||||||||||||||||||||||||||||||
NOTATION declaration | Notation declarations are placed inside a DTD. They are used to identify the format of non-XML data, and name (or point to) applications that will interpret the data. An example of a NOTATION declaration is <!NOTATION gif PUBLIC "gif viewer">. | ||||||||||||||||||||||||||||||||||||||
Using Entities Within Entities: | |||||||||||||||||||||||||||||||||||||||
CORRECT Example: <?xml version="1.0"?><!DOCTYPE author [ <!ELEMENT author (#PCDATA)> <!ENTITY email "josmith@theworldaccordingtojosmith.com"> <!--the following use of a general entity is legal if it is used in the XML document--> <!ENTITY js "Jo Smith &email;"> ]> <author>&js;</author> |
INCORRECT Example: <!--the two entity statements are infinitely recursive--><!ENTITY email "user@user.com &js;"> <!ENTITY js "Jo Smith &email;"> |
||||||||||||||||||||||||||||||||||||||
PCDATA | Parsed character data. Text that is not markup that is processed by a parser. | ||||||||||||||||||||||||||||||||||||||
start tag | The opening tag of an element. It follows the syntax: <name>, and must match the name in the end tag to be well-formed XML. | ||||||||||||||||||||||||||||||||||||||
Related References | |||||||||||||||||||||||||||||||||||||||
Documentation | |||||||||||||||||||||||||||||||||||||||
Related themes | Miscellaneous | Predefined GENERAL Entities: | |||||||||||||||||||||||||||||||||||||
XML HTML CSS |
|
|
|||||||||||||||||||||||||||||||||||||