[Expat-bugs] [ expat-Bugs-707469 ] external param entities

SourceForge.net noreply at sourceforge.net
Fri Mar 21 06:25:07 EST 2003


Bugs item #707469, was opened at 2003-03-21 07:51
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=707469&group_id=10127

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Pavel Hlavnicka (pavel_hlavnicka)
Assigned to: Nobody/Anonymous (nobody)
Summary: external param entities

Initial Comment:

Hi all,
perhaps, this is not a bug, perhaps it is. Give me some
explanation in the first case, please.

1) look at the example
2) It happens with 1.95.5 and 1.95.4 at least

We use expat in sablotron xslt processor. We do support
external entity parsing, and in addition we allow users
to tell, whether they want to parse public external
entities or not. In such a case we just return 1 from
our entity reference handler. (No entity parser is
created).

It results to a strange behavior, if following scenario
happens:

- the parsed document contains <!DOCTYPE blabla SYSTEM
"file.dtd">

- file.dtd contains the declaration of external public
parameter entity

- file.dtd references this entity

- file dtd defines other entities

This is sample file.dtd:
<!ENTITY % foo PUBLIC "xxx cvv" "data-e.dtd">
%foo;

<!ENTITY % baz "baz">
<!ENTITY % bar "somedata">
<!ENTITY %baz; "%bar;">

If %foo; is not referenced, all works fine, and &baz;
means "somedata". If %foo; is referenced, an error
occurs while parsing <!ENTITY %baz; "%bar;">, it seems,
that the entity expansion of %baz; and %bar; is empty.
If I replace <!ENTITY %baz; "%bar;"> with <!ENTITY baz
"%bar;"> paring goes fine, but &baz; points to an empty
string.

I played with a debugger a bit, and what I found was,
that if entity parser is not created in entity ref.
handler. dtd.paramEntityRead is not set to true, and
dtd.keepProcessing is set to false consequently. I'm
not sure, what the mission of dtd.keepProcessing is,
but it seems, that it stays valid a bit longer then
needed. Or do you really mean, that the whole file.dtd
content should be skipped, if the %foo; reference was
not resolved? If so, why I can see the compilation error?

Thank you very much and thanks for expat.


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

>Comment By: Karl Waclawek (kwaclaw)
Date: 2003-03-21 09:25

Message:
Logged In: YES 
user_id=290026

This has to do with section 5.1 of the spec
(http://www.w3.org/TR/REC-xml#proc-types):

<excerpt>
Except when standalone="yes", they must not process 
entity declarations or attribute-list declarations 
encountered after a reference to a parameter entity that 
is not read, since the entity may have contained 
overriding declarations.
</excerpt>

So, once %foo is not resolved/read, Expat must
not process any more entity and attribute declarations
in file.dtd. Try it again with standalone="yes".


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

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



More information about the Expat-bugs mailing list