Lists Home |
Date Index |
This is a proposal for a new mechanism for declaring internal entities,
requiring a new version of XML.
[I am not proposing this because I think it's a good idea - I can't see
a good solution at all - but because it's an obvious approach that
several people have talked to me about at W3C meetings and which has
not been discussed in the recent threads on the subject. Henry
Thompson proposed a similar mechanism a few years ago.]
Since XML 1.0, replacements have been invented for most aspects of DTDs:
- content restriction and typing is provided by XML Schemas, Relax NG,
- something similar to external entity inclusion is provided by XInclude
- ID-ness is being addressed by the current work on xml:id
In each case the replacement uses (or can use) XML instance syntax
rather than DTD syntax.
The obvious missing item from the list is internal entities,
especially in their use as names for characters.
In theory, XInclude can replace internal entities. The href in an
xinclude element can refer to a fragment of the same document. But
this is hardly convenient: it is very verbose, and you have to find
somewhere to put the text itself. XInclude works well for merging
small documents into a large document, but not so well for defining
frequently-used short sequences of characters.
The proposal is to continue to use the existing entity reference
syntax, while providing a new way to declare entities. The
declarations would use XML instance syntax, and be scoped to allow
multi-vocabulary documents where the vocabularies have their own
entity sets - in particular, it is not necessary to change the prolog
or higher-level elements to include a fragment which uses its own
The syntax for declaring a single entity is an attribute of the
Within the scope of the element with that attribute, é will refer
to the e-acute character.
The replacement text is not restricted to a single character:
A file of entity declarations can be specified by an attribute of the
or more than one file:
These files must contain a single element, whose name is arbitrary,
and that element may have xmlent:* and xmlentfile attributes. All the
entities declared in the file (and recursively) are in scope within
the element with the xmlentfile attribute.
Within the scope of such declarations, references to the entities are
both well-formed and valid. This implies a new XML version number.
There are many variations possible: the single inline declaration
could be removed; the file syntax could use elements, the entity names
could be namespaced, and so on. The key point is to have a scoped
mechanism for declaring internal entities using xml-instance syntax.