[Expat-discuss] FW: OverExecuting characterDataHandler()

James Renton james at interlockex.com
Wed Dec 10 17:17:28 CET 2008


I am using expat to quickly extract and parse an audio stream encoded in
base64.  This way I can include all kinds of useful meta-data as
attributes of each chunk.

The source of my audio produces 8000 – 32000 bytes per second.  I just
produced a working prototype and noticed that calls to my
characterDataHandler() (set by using XML_SetCharacterDataHandler()) are
occurring as follows:
1.	All bytes up to but excluding the first/next carriage return (in my
case 80)
2.	Carriage return (single byte)
3.	Repeat (1)

I am pushing this data off-process and streaming it to various endpoints
using sockets (not decoding).  This is producing a VERY LARGE quantity of
function calls to my handler which is not optimum.  It would be much
better if at least 1-15 kilobytes of data were passed to the
characterDataHandler  at a time rather.  My questions:
   1. How exactly does the character data parsing in expat work?  Some
insight in this regard might answer all of my questions.
   2. Is the behavior of the libraries calls to the handler configurable
in any way (possibly using #define’s, custom builds etc…)?
   3. Is there any other way to decrease the number of function calls in
this case?

I appreciate any feedback.

Thank you,

James
Beverly, MA



More information about the Expat-discuss mailing list