Você está na página 1de 2

Element Declaration Attribute Declaration

<!ELEMENT name (content-model) > <!ATTLIST element name declvalue default >
name of keyword or
keyword
name of the
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
repeat for
Quick Reference
, “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) (x|y) values as well as the keyword. Values
(#PCDATA | elem1 | elem2 )*
declared elsewhere with NOTATION.)
element
keyword name always
#PCDATA
Vertical Bar "|" include the * Attribute Defaults
"value" If attribute is omitted, assume this value.
ANY Element Keyword
#REQUIRED Required. Document is not valid if no
<!ELEMENT name ANY >
value is provided.
keyword
name of the keyword #IMPLIED Optional. Not constrained; no default can Mulberry Technologies, Inc.
element type, ANY
ELEMENT its "tag" be inferred; an application is free to handle 17 West Jefferson Street, Suite 207
as appropriate. Rockville, MD 20850 USA
EMPTY Element Keyword #FIXED Fixed value. (Requires a value as well as Phone: +1 301/315-9631
<!ELEMENT name EMPTY > "value" the keyword.) If the attribute appears with Fax: +1 301/315-8285
info@mulberrytech.com
name of the a different value, that’s an error.
keyword keyword http://www.mulberrytech.com
element type, EMPTY
ELEMENT its "tag"
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. © 2006 Mulberry Technologies, Inc. Technologies, Inc. © 2006 Mulberry Technologies, Inc.
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
m [ DOCTYPE declaration <!ENTITY % name External-ID >
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 "%"
t Tags and text:
the document shows this is a
y
parameter entity Notation Declaration
<!NOTATION name External-ID >
External Subset
D
o
c
<?xml version="1.0"?> DOCTYPE declaration General Entity Declarations keyword
NOTATION SYSTEM or PUBLIC identifier
u
<!DOCTYPE whatnot refers to a DTD in a
(PUBLIC does not require URI)
m SYSTEM "whatnot.dtd" > external subset. name of
e
n
t a file named: Internal Entity the entity
whatnot.dtd <!ENTITY name " whatever text " > (FAX, JPG, CGS, etc.)
E
n must be unique in DTD
t
i
t
entity value
y Tags and text: keyword (any literal)
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"?> DOCTYPE declaration
o
c <!DOCTYPE whatnot 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
n
whatnot.dtd ENTITY PUBLIC identifier keyword NDATA Start Tag with Attribute (in document)
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) the element sign ' or ", must match
&amp; & &#38;#38;
<![IGNORE[ declarations ]]>
<![INCLUDE[ declarations ]]> &lt; < &#38;#60;
&gt; > &#62; EMPTY Element (in document)
&apos; &#39; <name/>
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. Technologies, Inc. © 2006 Mulberry Technologies, Inc. Technologies, Inc. © 2006 Mulberry Technologies, Inc.
© 2006 Mulberry Technologies, Inc.

Você também pode gostar