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

Marat BN maratbn at yahoo.com
Thu Nov 24 22:42:57 CET 2005


Yep, that's what I'm doing right now, but you're right, I don't like this decoding and then re-encoding because that's not using the processing power efficiently.
 
  ----- Original Message ----- 
  From:   Nick   MacDonald 
  To: Marat BN 
  Cc: expat-discuss at libexpat.org 
  Sent: Thursday, November 24, 2005 1:25   PM
  Subject: Re: [Expat-discuss] Question   about the libexpat character data handler automatic escape sequence   decoding.
  

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 
		
---------------------------------
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.


More information about the Expat-discuss mailing list