After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 126211 - xmlIOParseDTD() fails if character encoding is given
xmlIOParseDTD() fails if character encoding is given
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.1
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2003-11-04 17:25 UTC by Markus Keim
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Markus Keim 2003-11-04 17:25:41 UTC
When calling xmlIOParseDTD(), a new xmlParserCtxt is
build and xmlNewIOInputStream() is called with that
context, the given xmlParserInputBufferPtr and encoding.
If the encoding is unequal to XML_CHAR_ENCODING_NONE,
xmlSwitchEncoding() and than xmlSwitchToEncoding() is called,
again with the new parser context and the appropriate
encoding handler (if found).
xmlSwitchToEncoding() now checks (ctxt->input != NULL)
and calls
xmlErrInternal(ctxt, "xmlSwitchToEncoding : no input\n",
	                   NULL);
since the newly build context obviously has no input
pointer.
xmlErrInternal() sets ctxt->wellFormed = 0 and after
xmlIOParseDTD() has called xmlParseExternalSubset(),
it checks (ctxt->wellFormed) and returns NULL.

Some debugging in v2.5.4 and v2.6.1 shows that switching
to the given encoding fails in both versions due to the
check of (ctxt->input != NULL), but only v2.6.1 sets
ctxt->wellFormed = 0.

As a result it's not possible to parse in a DTD
using xmlIOParseDTD() with a character encoding
unequal to XML_CHAR_ENCODING_NONE.
Comment 1 Daniel Veillard 2003-12-07 19:32:40 UTC
Okay, I think I fixed it (though I didn't have a way to test it)
basically creating the input with xmlNewIOInputStream, then
calling xmlSwitchEncoding() after the call of xmlPushInput()
Commited in CVS,

  thanks,

Daniel
Comment 2 Daniel Veillard 2004-01-26 13:21:37 UTC
This should be closed in release of libxml2-2.6.5,
                                                                     
          
Daniel