Stylus Studio XML Editor

Table of contents

Appendices

4.1 Character and Entity References

Character and Entity References

A character reference refers to a specific character in the ISO/IEC 10646 character set, for example one not directly accessible from available input devices.

Character Reference
4.1    CharRef   ::=   '&#' [0-9]+ ';'
| '&#x' [0-9a-fA-F]+ ';'

Well Formedness Constraint: Legal Character

Legal Character

Characters referred to using character references MUST match the production for Char.

If the character reference begins with "&#x", the digits and letters up to the terminating ; provide a hexadecimal representation of the character's code point in ISO/IEC 10646. If it begins just with "&#", the digits up to the terminating ; provide a decimal representation of the character's code point.

An entity reference refers to the content of a named entity. References to parsed general entities use ampersand (&) and semicolon (;) as delimiters. Parameter-entity references use percent-sign (%) and semicolon (;) as delimiters.

Entity Reference
4.1    Reference   ::=   EntityRef | CharRef
4.1    EntityRef   ::=   '&' Name ';'
[VC: Entity Declared]
4.1    PEReference   ::=   '%' Name ';'[VC: Entity Declared]

Well Formedness Constraint: Entity Declared

Entity Declared

In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", for an entity reference that does not occur within the external subset or a parameter entity, the Name given in the entity reference MUST match that in an entity declaration that does not occur within the external subset or a parameter entity, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. The declaration of a general entity MUST precede any reference to it which appears in a default value in an attribute-list declaration.

Note that non-validating processors are not obligated to to read and process entity declarations occurring in parameter entities or in the external subset; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone='yes'.

Validity Constraint: Entity Declared

Entity Declared

In a document with an external subset or external parameter entities with "standalone='no'", the Name given in the entity reference MUST match that in an entity declaration. For interoperability, valid documents SHOULD declare the entities amp, lt, gt, apos, quot, in the form specified in [Predefined Entities]. The declaration of a parameter entity MUST precede any reference to it. Similarly, the declaration of a general entity MUST precede any attribute-list declaration containing a default value with a direct or indirect reference to that general entity.

Well Formedness Constraint: Parsed Entity

Parsed Entity

An entity reference MUST NOT contain the name of an Unparsed Entity. Unparsed entities may be referred to only in Attribute Value declared to be of type ENTITY or ENTITIES.

Well Formedness Constraint: No Recursion

No Recursion

A parsed entity MUST NOT contain a recursive reference to itself, either directly or indirectly.

Well Formedness Constraint: In DTD

In DTD

Parameter-entity references MUST NOT appear outside the Document Type Declaration.

Examples of character and entity references:

Type <key>less-than</key> (&#x3C;) to save options.
This document was prepared on &docdate; and
is classified &security-level;.

Example of a parameter-entity reference:

<!-- declare the parameter entity "ISOLat2"... -->
<!ENTITY % ISOLat2
SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
<!-- ... now reference it. -->
%ISOLat2;