[ expat-Bugs-413551 ] internal parameter entities not handled

noreply@sourceforge.net noreply@sourceforge.net
Wed, 18 Apr 2001 13:24:04 -0700


Bugs item #413551, was updated on 2001-04-03 15:41
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=413551&group_id=10127

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: internal parameter entities not handled

Initial Comment:
In the attached file there are 2 entities that are 
misinterpreted.

&test;  - the entity definition compiles but causes 
and error when referenced, yet it is cleary legal and 
should produce the output listed in the comment.

&book; - this is an entity example taken from the 
XML recommendation.  The parameter entity 
reference within the book entity declaration causes 
and error.  The recommendation is clear that this 
should work.

I consider these to be high priority.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-04-18 13:24

Message:
Logged In: NO 

I did some further investigation on the &book; entity and 
have discovered the problem.  This issue is that 
section 4.5 of the XML recommendation is, I believe, 
somewhat unclear because it is missing a reference to 
a previous definition.

In section 4.5 it describes how to calculate the 
replacement text for an internal entity.  However it does 
not distinguish between entities defined in the internal 
subset and those defined externally.  Only the former 
group come under the "PEs in internal subset" 
constraint.

So the example &book; entity is legal if placed in an 
external entity but is not legal if defined in the iternal 
subset like in the attached example.  I tried this and 
expat handles the external case fine.

This is a sublte case because the constraint is context 
sensitive and so is not directly represented in the 
grammer but instead is in a side note, that is 
unfortunately not mentioned in all entity descriptions.

I consider this closed now.  Sorry about reporting the 
non-bugs but thanks for the prompt response.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-04-06 08:22

Message:
Logged In: NO 

Re the &test; entity. There was a typo in the example 
file.  If you close of the element the entity is still 
incorrect.  After the comments on this I did some more 
investigation and discovered the problem.  Its the 
difference between ' and ' both of which 
represent the character ' and both of which expat 
understands.

However &#x27 is a character reference and thus is 
expanded to create the entity replacement text.  This is 
what you need for to generate the attr = "value".  ' 
is  a general entity, eventhough it is predefined.  Thus it 
is not expanded and the replacement text becomes:
attr = 'value'

This is why the entity definition is correct but the usage 
is not.  Sorry about that.  I missed the sentence in the 
XML spec that defines the entity type for ' etc.

Conclusion expat does the right thing with the test entity 
in all forms I have tried.

----------------------------------------------------------------------

Comment By: Paul Prescod (prescod)
Date: 2001-04-05 13:17

Message:
Logged In: YES 
user_id=31788

I went to download this to look at it but it turns out I didn't have to look at it very closely. Internet Explorer 
gives a correct error message:

"Parameter entities cannot be used inside markup declarations in an internal subset. Line 9, Position 4"

"Well-formedness constraint: PEs in Internal Subset

In the internal DTD subset, parameter-entity references can occur only where markup declarations can 
occur, not within markup declarations. (This does not apply to references that occur in external parameter 
entities or to the external subset.)"

I'll leave it to Fred to close but I don't think there is a bug here.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-04-05 12:36

Message:
Logged In: YES 
user_id=3066

[ Testing configuration of the bugs mailing list. ]

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-04-04 21:19

Message:
Logged In: YES 
user_id=3066

Regarding the &test; reference:  this is not legal.  The entity does not close the <element/> element, so cannot actually be used.

I still need to dig into the &book; issue.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-04-04 18:41

Message:
Logged In: YES 
user_id=3066

Assigned to me to at least determine if this is still a problem with the CVS version.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-04-03 15:43

Message:
Logged In: NO 

This was tested against version expat 1.2 from 
jclark.com.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=413551&group_id=10127