[Expat-bugs] [ expat-Bugs-620106 ] XML_SetEncoding and external
entities
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 11 Oct 2002 06:33:45 -0700
Bugs item #620106, was opened at 2002-10-08 07:36
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=620106&group_id=10127
Category: None
Group: Test Required
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Pavel Hlavnicka (pavel_hlavnicka)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: XML_SetEncoding and external entities
Initial Comment:
We are using expat with Sablotron XSLT processor.
Before parsing (using always XML_Parse) we check the
document encoding and in the case it is not supported
by expat, we call XML_SetEncoding to set utf-8, and
recode the document before feeding the parser.
All is ok until we parse external entities. We create
an external entity parser with
XML_ExternalEntityParserCreate, but we don't know the
document encoding at this time. We use XML_SetEncoding
later (the same case as for the 'root' document). In
this case it doesn't work.
I found out, that problem is probably in the
XML_SetEncoding function, what just returns zero in the
case parsing is in progress.
The ``parsing'' macro checks, whether the current
processor is ``prologInitProcessor'', what is never
true for external entity parser. For this is it
``externalEnityInitProcessor''.
The patch seems be easy, but, of course, I'm not sure
I'm not breaking anything else.
Thanks and keep your good work.
----------------------------------------------------------------------
>Comment By: Pavel Hlavnicka (pavel_hlavnicka)
Date: 2002-10-11 13:33
Message:
Logged In: YES
user_id=302801
It makes a good job for me, so I can confirm. Thanks, it
was pretty fast.
----------------------------------------------------------------------
Comment By: Karl Waclawek (kwaclaw)
Date: 2002-10-09 13:23
Message:
Logged In: YES
user_id=290026
Applied patch - xmlparse.c rev. 1.93.
Leave open for Fred, in case he wants to add
a regression test.
----------------------------------------------------------------------
Comment By: Karl Waclawek (kwaclaw)
Date: 2002-10-08 14:43
Message:
Logged In: YES
user_id=290026
I have changed this to a bug report and accepted it.
Your patch seems OK, but does not go far enough..
Please try this one and give it a quick check so
that I can commit it to CVS:
#define parsing \
(parentParser \
? \
(isParamEntity \
? \
(processor != externalParEntInitProcessor) \
: \
(processor != externalEntityInitProcessor)) \
: \
(processor != prologInitProcessor))
----------------------------------------------------------------------
Comment By: Pavel Hlavnicka (pavel_hlavnicka)
Date: 2002-10-08 07:39
Message:
Logged In: YES
user_id=302801
The patch was not uploaded for some reason (the magic
checkbox?? :)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=620106&group_id=10127