Re: [xml] PEReferences - tricky and error-prone

Hash: SHA1

At 06:50 3/6/02, Peter Jacobi wrote:
Given that the original example is valid,

I had actually assumed that the original one was invalid, but I was wrong; 
if is valid SGML and isn't ruled out by anything in the XML Recommendation, 
then it's usually a good bet that it is intentionally correct XML (as 
opposed to one of those places where we all took SGML knowledge for granted).

I assume
the following one is also valid, due to the automatic
insertion of blanks around the replacement text:

<!ENTITY % percent "&#x25;">
<!ENTITY%percent;def "ghi">
<!ENTITY abc "%def;">

Ick - this seems to be one of those places.  The space-adding rule is not 
part of SGML, and so that would absolutely not be valid SGML.  The 
space-adding rule was intended to simplify things by making sure that the 
PEs were always complete tokens (avoiding things like:

<!ENTITY % foo "foo">
<!ENTITY % bar "bar">
<!ELEMENT %foo;%bar; (#PCDATA)>

) but as usual, it appears to have had unintended consequences.  My feeling 
for now is that a parser should accept your example, but if at all 
possible, issue a *very* strong warning, because it seems likely to be made 
illegal in an erratum.

And I assume, that unescaped use of the
percent sign (as seen in Matthias' SGML
example) is not valid XML:

<!ENTITY % percent "%">
<!ENTITY %percent; def "ghi">
<!ENTITY abc "%def;">

No, it wouldn't be valid XML.  It's valid SGML because of the baroque 
delimiter-in-context rules which mean that % isn't a pero unless followed 
by a name start character.

~Chris, feeling unclean now
- -- 
Christopher R. Maden, Principal Consultant, crism consulting
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
<URL: >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA
Version: PGP Personal Privacy 6.5.8


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]