XML Syntax Quick Reference

3 downloads 21998 Views 1MB Size Report
Quick Reference. Mulberry Technologies, Inc. 17 West Jefferson Street, Suite 207 . Rockville, MD 20850 USA. Phone: +1 301/315-9631. Fax: +1 301/315-8285.
Element Declaration
Attribute Declaration

(content-model) >

name

name of the keyword element type, formal definition of the element's allowed content ELEMENT its "tag"

“Then”

Follow with (in sequence)

|

Select (only) one from the group “Or” Only one connector type per group — no mixing!

Occurrence Indicators (no indicator) ? * +

Required Optional Optional, repeatable Required, repeatable

One and only one None or one None, one, or more One or more

Groupings ( )

Start content model or group End content model or group

#PCDATA in Models (first, OR bars, asterisk) (#PCDATA) (#PCDATA | elem1 | elem2 )* keyword #PCDATA

element name always Vertical Bar "|" include the *

ANY Element Keyword
name

name of the keyword element type, ELEMENT its "tag"

ANY

>

keyword ANY

EMPTY Element Keyword
keyword or name of default value attribute what kind of value or list of values

keyword ATTLIST name of the associated element

Connectors ,



name

name of the keyword element type, ELEMENT its "tag"

EMPTY

>

keyword EMPTY

XML Syntax Quick Reference

repeat for each attribute

Declared Value Keywords CDATA NMTOKEN NMTOKENS ID IDREF IDREFS ENTITY ENTITIES

Data character string (default if well-formed) Name token One or more name tokens (spaces between) Unique identifier for element Reference to ID on another element One or more IDREFs (spaces between) Name of an entity (declared elsewhere) One or more names of entities

Enumerated Value Descriptions (a|b|c) NOTATION (x|y)

List of attribute values (Or between) Names of notations (Requires a list of values as well as the keyword. Values declared elsewhere with NOTATION.)

Attribute Defaults If attribute is omitted, assume this value. "value" #REQUIRED Required. Document is not valid if no value is provided. #IMPLIED Optional. Not constrained; no default can be inferred; an application is free to handle as appropriate. #FIXED Fixed value. (Requires a value as well as "value" the keyword.) If the attribute appears with a different value, that’s an error.

Mulberry Technologies, Inc. 17 West Jefferson Street, Suite 207 Rockville, MD 20850 USA Phone: +1 301/315-9631 Fax: +1 301/315-8285 [email protected] http://www.mulberrytech.com

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 Technologies, Inc.

© 2006 Mulberry Technologies, Inc.

Mulberry Technologies, Inc.

© 2006 Mulberry Technologies, Inc.

DOCTYPE Declaration

Parameter Entity Declarations

name of the the internal document subset of type the DTD pointer to (optional) another file DSC DSO keyword Declaration Declaration DOCTYPE Subset Open Subset Close

Internal Subset D o c u m e n t



includes other declarations in an internal subset

Tags and text: the document



Internal Parameter Entity
name

%

"

whatever text

name of the entity

entity value (any literal)

percent sign "%" shows this is a parameter entity

"

single or double quotes, ' or ", must match

External Parameter Entity
name

%

External-ID

>

Processing Instruction

name of keyword the entity ENTITY percent sign "%" shows this is a parameter entity



pointer to a file

Notation Declaration
DOCTYPE declaration external subset. a file named:

whatnot.dtd

E n t i t y

Tags and text: the document

General Entity Declarations Internal Entity
name

"

keyword ENTITY name of the entity

Internal and External Subsets D o c

DOCTYPE declaration refers to an external subset and includes an internal subset. DTD is sum of the parts. a file named:

whatnot.dtd

E n t i t y

Tags and text: the document

Conditional Section (DTD only)

External-ID OR

Standalone declaration: no: parsing affected by external DTD subset yes: parsing not affected by external DTD subset Character encoding of the document, expressed in Latin characters, e.g. UTF-8, UTF-16, EUC-JP, ISO-10646-UCS2

Version of the XML specification

>

External Subset D o c u m e n t

XML Declaration

SYSTEM "URI" PUBLIC "Public ID" "URI"

whatever text

" >

entity value (any literal)

name

External-ID

NDATA name

>

Predefined General Entities Displays As & < > ' "

External-ID

>

SYSTEM or PUBLIC identifier (PUBLIC does not require URI) name of the entity (FAX, JPG, CGS, etc.) must be unique in DTD



keyword SYSTEM or ENTITY PUBLIC identifier keyword NDATA name of followed by the entity notation name

Entity & < > ' "

name

Comment

single or double quotes, ' or ", must match

External Unparsed Entity
keyword NOTATION

Character Value & < > ' "

Comment may contain any characters except the string "--".

Start Tag with Attribute (in document) one or more name of the values attribute name of equals single or double quotes, the element ' or ", must match sign

EMPTY Element (in document)

CDATA Section (in document)

Mulberry Technologies, Inc.

© 2006 Mulberry Technologies, Inc.

Mulberry Technologies, Inc.

© 2006 Mulberry Technologies, Inc.

Mulberry Technologies, Inc.

© 2006 Mulberry Technologies, Inc.