XML 1.0 3e spec, Scope of parameter entity def?

With reference to:
   http://www.w3.org/TR/2004/REC-xml-20040204
[[
Extensible Markup Language (XML) 1.0 (Third Edition)
W3C Recommendation 04 February 2004
]]

What is the scope of a parameter entity definition?  Is it limited to the 
physical entity in which it appears, or can be carried into/out of external 
parameter entities?

Consider:

ExhibitA.xml:
[[
<!DOCTYPE doc [
<!ELEMENT doc (#PCDATA)>
<!ENTITY % e1 SYSTEM "ExhibitE1.ent">
<!ATTLIST doc a1 CDATA "v1">
%e1;
%e2;
<!ATTLIST doc a2 CDATA "v2">
]>
<doc></doc>
]]

ExhibitE1.ent
[[
<!ENTITY % e2 SYSTEM "ExhibitE2.ent">
]]

ExhibitE2.ent
[[
<!ATTLIST doc a3 CDATA "v3">
]]

Is the definition of %e2; in ExhibitE1.ent carried back into the containing 
ExhibitA.xml?

The specification makes reference to "replacement text" for PEs (sections 
4.4.5, 4.4.8), and also the comment in section 4.3.2 that all external PEs 
are well-formed by definition, suggests that the answer is yes:  the total 
should be treated as if the PEs replacement text is included inline.

If true, this creates something of an implementation problem, because there 
is no clear separation between parsing, and textual substitution that may 
affect the results of parsing.  In order to text to be substituted, 
parameter entity definitions must be parsed.  But the inclusion of 
replacement text may invalidate the parse.

Is an implementation really supposed to handle cases like this ?:

[[
<!ENTITY % percent SYSTEM "percent.ent">
<!ENTITY % pe1 '<!ENTITY percent pe2 "<!ATTLIST doc a1 CDATA &34;v1&34;>">'>
%pe1;
%pe2;
]]
where percent.ent contains just a '%' character, and (&34; == ")

#g


------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

Received on Friday, 4 June 2004 08:08:09 UTC