[Expat-discuss] CharacterDataHandler -- why no element name?
Greg Martin
Greg.Martin at TELUS.COM
Tue Aug 17 21:33:52 CEST 2004
> -----Original Message-----
> From: expat-discuss-bounces+greg.martin=telus.com at libexpat.org
> [mailto:expat-discuss-bounces+greg.martin=telus.com at libexpat.org]On
> Behalf Of William Park
> Sent: Saturday, August 14, 2004 12:38 AM
> To: expat-discuss at libexpat.org
> Subject: [Expat-discuss] CharacterDataHandler -- why no element name?
>
>
> Hi all,
>
> After reading the documentation of Expat-1.95.8, I am
> wondering why the
> callback function for text data, as in
>
> void XMLCALL texthandler (userData, s, len)
> void *userData;
> char *s;
> int len;
> { ... }
>
> XML_SetCharacterDataHandler(p, texthandler)
>
> doesn't get element name as argument. Without it, I don't know which
> element this text belongs to, and have to keep track of previous
> elements which were opened/closed. Shouldn't the parser be the one
> keeping track?
>
It's not required. The document gets parsed sequentially so the element being
parsed is the last one passed to the start element handler.
More information about the Expat-discuss
mailing list