[
Lists Home |
Date Index |
Thread Index
]
Richard Tobin writes:
> The syntax for declaring a single entity is an attribute of the
> form:
>
> xmlent:eacute="é"
>
> 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:
>
> xmlent:author="Richard Tobin"
>
> A file of entity declarations can be specified by an attribute of the
> form:
>
> xmlentfile="http://example.org/ents"
>
> or more than one file:
>
> xmlentfile="http://example.org/ents1 http://example.org/ents2"
>
> 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.
I am not sure I like your proposed file format. I would rather the file
declared entities using elements, since the entities described by the file
have different scope to entities declared using attributes --- they apply not
to the scope of the declaring element, but to the scope of an element in the
XML document that refers to this file. How about:
<xmlent:entities>
<xmlent:entity name="eacute" value="é"/>
<xmlent:entity name="author" value="Richard Tobin"/>
<xmlent:include href="http://www.example.com/another_entity_file.xml"/>
</xmlent:entities>
That would also allow entities to be declared on these elements that only
applied within the entity file:
<xmlent:entities xmlent:foo="foo bar flibble">
<xmlent:entity name="foo1" value="&foo; 1"/>
<xmlent:entity name="foo2" value="&foo; 2"/>
</xmlent:entities>
> 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.
Does "the scope of the element with that attribute" include other attributes
on that element? If so, is ordering important?
What level of attribute value normalization and entity expansion is performed
on the text values provided for these attributes?
e.g. is the following valid?
<abc xmlent:aaa="&zzz;" xmlent:zzz="hello"/>
These questins are important because it determines how much of an existing
parser/tool is affected by the change. If ordering is important, then existing
non-validating XML transformation tools that reorder attributes may
inadvertantly break an XML document if they are not aware of xmlent.
Likewise, if normalization *does* happen, then it is important that entities
are declared before they are used --- in which case the parser may have to
read all attributes before normalizing any in case they cross-reference. OTOH,
if normalization *doesn't* happen, this is distinct from normal attribute
processing, so requires a change there.
Anthony
--
Anthony Williams
Senior Software Engineer, Beran Instruments Ltd.
|