[Expat-discuss] Question about the libexpat character data handler automatic escape sequence decoding.

Nick MacDonald nickmacd at gmail.com
Thu Nov 24 22:25:32 CET 2005


Well the obvious answer, which you may not like, would be to assume that
those escaped characters could never "occur naturally" so if you want, just
reconvert them back after receiving them in the
XML_SetCharacterDataHandler().

On 11/24/05, Marat BN <maratbn at yahoo.com> wrote:
>
> I have a question regarding the libexpat character
> data handler callback
> function that's set via libexpat API method
> XML_SetCharacterDataHandler(...)
>
> I noticed that by default libexpat decodes the XML
> escape sequences from
> text being parsed before passing them to the character
> data handler. -- If
> the XML string being parsed contains XML escape
> sequences, such as > <
> & &#xxxx; etc, then the XML_Char * string provided
> to the character data
> handler will have all these escape sequences decoded.
> libexpat must be
> automatically doing this decoding internally.
>
> In my application, I would like to receive the escape
> sequences intact.
> Does anyone know how to prevent the character data
> handler from
> automatically decoding the XML escape sequences?  Or
> is there another
> separate data handler callback function that leaves
> the escape sequences
> intact?
>
> On a related issue -- does libexpat have a separate
> API to encode/decode XML
> escape sequences?
>

--
Nick MacDonald
NickMacD at gmail.com


More information about the Expat-discuss mailing list