Re: XML 1.0 Fifth Edition Specification Errata

On Sun, 2015-12-13 at 18:34 +0100, Patrik Mlekuž wrote:
> Hello,
> 
>  
> 
> I am studying  "XML 1.0 (Fifth Edition)" specification and it looks
> that I
> have found some insufficient definition regarding "Element Type
> Declaration".
> 
> 
> Take a closer look here <http://www.w3.org/TR/xml/#NT-children> .
> There is
> an example of using parameter-entities in element type declaration:
> <!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*>,
> 
> but the definition of element type declaration[...] doesn't seem to
> allow them (or am I missing something?).
> 

[personal reply]

Parameter entity references are replaced by their "replacement text"
when the parser sees them (with an extra space inserted at the start
and end), so the final content model for dictionary-body that the
parser uses doesn't have %div.mix; in it, it has the replacement text,
whatever that happens to be. For example, given
<!ENTITY div.mix % "div1|div2">
<!ENTITY dict.mix % "shoe|sock">
we end up with
<!ELEMENT dictionary-body ( div1|div2  |  shoe|sock )*>

You could also use
<!ENTITY sep % '|'>
<!ELEMENT boy (noise %sep; dirt)*>
and that would turn into
<!ELEMENT boy ( noise  |  dirt )*>

See http://www.w3.org/TR/xml/#as-PE for the extra spaces.

See http://www.w3.org/TR/xml/#entproc for parameter entities being
processed in a DTD (declaration) context.

I hope this helps,

Liam


-- 
Liam R. E. Quin <liam@w3.org>
Head of XML Work
The World Wide Web Consortium (W3C)

Received on Monday, 14 December 2015 08:04:27 UTC