[xml] Problems using xmlIOParseDTD() with given encoding

Hello Daniel, hello all,

i've recently switched to libxml2-2.6.1 and encountered a
problem when using xmlIOParseDTD() to subesequently
validate a document with a given encoding (more precise:
the problem turns up in xmlSwitchToEncoding(), at least
since v2.5.4, but the (new?) error handling using
xmlErrInternal() makes it more obvious).

When calling xmlIOParseDTD(), a brand 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",
since the newly build context obviously has no input
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.

So, for what i currently see it's
- not possible to use xmlIOParseDTD() with a given
  encoding in recent versions of libxml2
- it's possible in prior versions, but the encoding won't
  be took into account

I'm tackling things wrong or is there an actual problem
in libxml2?
And if so, how could it be solved (i don't think that the
check for (ctxt->input != NULL) in xmlSwitchToEncoding()
could be generally dropped)?

Thanks & Ciao, Markus

Mit freundlichen Gruessen - Kind regards
Markus Keim

________________________Addressed by:________________________
 ORDAT GmbH & Co. KG  -  Serversystems / eCom 
 Dipl.-Inf. (FH) Markus Keim   Fon: +49 (641) 7941-0
 Rathenaustr. 1                Fax: +49 (641) 7941-132
 35394 Gießen                  mailto:markus_keim ordat com
 See:                          http://www.ordat.com
I love deadlines. I like the whooshing sound they make as
they fly by.  -- Douglas Adams

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]