[Expat-bugs] [ expat-Patches-620106 ] XML_SetEncoding and external entities

noreply@sourceforge.net noreply@sourceforge.net
Tue, 08 Oct 2002 00:36:53 -0700


Patches item #620106, was opened at 2002-10-08 07:36
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=310127&aid=620106&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: 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.

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

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