[Expat-discuss] Parsing CDATA section

Ramprasad B ramprasad.i82 at gmail.com
Sun May 27 13:26:53 CEST 2007


On 5/26/07, Marco Forberg <marco.forberg at gmx.net> wrote:

Expat treats CDATA as any other text BUT calls the cdata start and end
> handlers before and after it passes your text to the text handler. So the
> the order of the calls would be the following:
>
> CDATA section start handler
> Text handler <-- this is your CDATA
> CDATA section end handler


Here's my code:

static void XMLCALL
startcData(void *userData){
  int *depthPtr = (int *)userData;
  /*I am unable to get cdata here. userData contains a single byte here*/
}

static void XMLCALL
endcData(void *userData){
    ;
}

int main(){
  XML_SetCdataSectionHandler(parser, startcData, endcData);
}

XML file:

<A>
  <B>
    <C><![CDATA[Hello World]]></C>
  </B>
</A>

I see that when the CDATA section starts, the startcData fucntion is called.

It's still not working ! BTW, which ptr points to CDATA section when the
startcData is called ?

Thanks !
-
Ramprasad B


More information about the Expat-discuss mailing list