Re: [xml] crash in charactersSAXFunc



On Sun, 3 Jun 2001, Adrian Feiguin wrote:

 My program uses the SAX interface to parse an encoded image, lets say
that I'm using base64 encoding. 
 The charactersSAXFunc callback 
returns a string with all the character between tags, and I want to use 
it to reconstruct the original image. If the string
is too long (apparently len = 1000), my program crashes. 
 Can anybody tell me what's wrong? How can I overcome this?

An XML parser isn't guaranteed to return the entire contents of a tag in a
characters callback. It is free to break on every byte, or newlines, or
entities, or...

So your application is most likely expecting all the base64 string, but
only getting part of it. Use a buffer to bundle it all together, and
process the string in the call to end_element.

-- 
<Matt/>

    /||    ** Founder and CTO  **  **   http://axkit.com/     **
   //||    **  AxKit.com Ltd   **  ** XML Application Serving **
  // ||    ** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
     \\//
     //\\
    //  \\





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