Anda di halaman 1dari 2

Element Declaration Attribute Declaration

<!ELEMENT name (content-model) > <!ATTLIST element name declvalue default >
name of keyword or
name of the
keyword element type, formal definition of the
ELEMENT its "tag" element's allowed content
keyword
ATTLIST
attribute
what kind of
default value
value or list of
XML Syntax
values
Connectors name of the
associated
element
Quick Reference
repeat for
, “Then” Follow with (in sequence) each attribute
| “Or” Select (only) one from the group
Declared Value Keywords
Only one connector type per group — no mixing!
CDATA Data character string (default if well-formed)
Occurrence Indicators NMTOKEN Name token
(no indicator) Required One and only one NMTOKENS One or more name tokens (spaces between)
? Optional None or one ID Unique identifier for element
* Optional, repeatable None, one, or more IDREF Reference to ID on another element
+ Required, repeatable One or more IDREFS One or more IDREFs (spaces between)
ENTITY Name of an entity (declared elsewhere)
Groupings
ENTITIES One or more names of entities
( Start content model or group
) End content model or group Enumerated Value Descriptions
(a|b|c) List of attribute values (Or between)
#PCDATA in Models (first, OR bars, asterisk)
NOTATION Names of notations (Requires a list of
(#PCDATA)
(#PCDATA | elem1 | elem2 )*
(x|y) values as well as the keyword. Values
declared elsewhere with NOTATION.)
element
keyword name always
#PCDATA Attribute Defaults
Vertical Bar "|" include the *

"value" If attribute is omitted, assume this value.


ANY Element Keyword
<!ELEMENT name ANY > #REQUIRED Required. Document is not valid if no
value is provided.
name of the keyword #IMPLIED Optional. Not constrained; no default can Mulberry Technologies, Inc.
keyword element type,
ELEMENT its "tag" ANY
be inferred; an application is free to handle 17 West Jefferson Street, Suite 207
as appropriate. Rockville, MD 20850 USA
EMPTY Element Keyword Phone: +1 301/315-9631
#FIXED Fixed value. (Requires a value as well as
<!ELEMENT name EMPTY > Fax: +1 301/315-8285
"value" the keyword.) If the attribute appears with
info@mulberrytech.com
name of the keyword a different value, that’s an error. http://www.mulberrytech.com
keyword element type,
ELEMENT its "tag" EMPTY
Reserved Attributes
xml:space Preserve whitespace or use default
xml:lang Indicate language of element and that
element’s attributes and children

Mulberry
Technologies, Inc.

Mulberry Mulberry
Technologies, Inc. © 2000 Mulberry Technologies, Inc. Technologies, Inc. © 2000 Mulberry Technologies, Inc. (20000621)
DOCTYPE Declaration Parameter Entity Declarations XML Declaration
<!DOCTYPE name External-ID [ declarations ] > <?xml version="1.0" encoding="UTF-8" standalone="no"?>
Internal Parameter Entity
name of the the internal Standalone declaration:
document <!ENTITY % name " whatever text " > Version of the
subset of
type the DTD XML specification no: parsing affected by
pointer to (optional)
another file keyword name of entity value external DTD subset
keyword DSO DSC ENTITY the entity (any literal) yes: parsing not affected by
DOCTYPE Declaration Declaration external DTD subset
Subset Open Subset Close percent sign "%"
shows this is a single or double quotes, Character encoding of the
parameter entity ' or ", must match
document, expressed in
Internal Subset Latin characters, e.g. UTF-8, UTF-16,
D
o
<?xml version="1.0"?> External Parameter Entity EUC-JP, ISO-10646-UCS2
c <!DOCTYPE whatnot
u <!ENTITY % name External-ID >
m [ DOCTYPE declaration
e includes other declarations
n
t in an internal subset
name of
Processing Instruction
keyword
E ]> ENTITY the entity pointer to a file <?target ***Some Stuff **** ?>
n
t
i percent sign "%"
Tags and text:
t shows this is a
y the document
parameter entity Notation Declaration
<!NOTATION name External-ID >
External Subset
D
o
<?xml version="1.0"?> DOCTYPE declaration General Entity Declarations keyword
NOTATION SYSTEM or PUBLIC identifier
c <!DOCTYPE whatnot refers to a DTD in a
u (PUBLIC does not require URI)
m SYSTEM "whatnot.dtd" > external subset. name of
e
n
a file named:
Internal Entity the entity
t
whatnot.dtd <!ENTITY name " whatever text " > (FAX, JPG, CGS, etc.)
E
n must be unique in DTD
t
i entity value
t keyword (any literal)
y Tags and text:
ENTITY name of
the document the entity single or double quotes, Comment
' or ", must match
Internal and External Subsets <!-- Whatever you want to say! -->
D <?xml version="1.0"?>
o
c <!DOCTYPE whatnot
DOCTYPE declaration
refers to an external External Unparsed Entity Comment may contain any
u SYSTEM "whatnot.dtd" subset and includes an characters except the string "--".
m[ internal subset. <!ENTITY name External-ID NDATA name >
e DTD is sum of the parts.
n
t ]> a file named: keyword SYSTEM or
E
whatnot.dtd ENTITY PUBLIC identifier keyword NDATA Start Tag with Attribute (in document)
n
t
name of followed by
i the entity notation name <tag attributename = " attribute-value " >
t Tags and text:
y
the document
Predefined General Entities name of the one or more
attribute values
Entity Displays As Character Value name of equals single or double quotes,
Conditional Section (DTD only) &amp; &#38;#38;
the element sign ' or ", must match
&
<![IGNORE[ declarations ]]>
<![INCLUDE[ declarations ]]> &lt; < &#38;#60;
&gt; > &#62; EMPTY Element (in document)
<name/>
&apos; ’ &#39;
External-ID <name></name>
SYSTEM "URI" &quot; " &#34;
OR
PUBLIC "Public ID" "URI"
CDATA Section (in document)
<![CDATA[ *** Some Stuff *** ]]>

Mulberry Mulberry Mulberry


Technologies, Inc. © 2000 Mulberry Technologies, Inc. Technologies, Inc. © 2000 Mulberry Technologies, Inc. Technologies, Inc. © 2000 Mulberry Technologies, Inc.

Anda mungkin juga menyukai