[Expat-discuss] How to handle text-data associated to a tag

Marco Forberg marco.forberg at gmx.net
Wed Dec 29 10:20:48 CET 2004


You will have to set a CharacterDataHandler in order to deal with text 
between the tags. The tag around the text is the last one that triggered 
the call to your StartElementHandlers. So you might have to store the 
variable-name to know where the value belongs. Using a flag could also be 
usefull to make sure you're parsing text inside the value-element.

Am Tue, 28 Dec 2004 19:31:20 -0600 (CST) hat <odisseo at despammed.com> 
geschrieben:

> Ho can I handle the text-data in the example:
> <value variable="x">12</value>
> <value variable="y">-9</value>
> <value variable="z">232</value>
> I want to create a map
> < <x,12> , <y,-9> , <z,232> >
> so I need to know the value between start and end tag.
>
> The code for the start tag function could be
>
> static void startElement(void *userData, const char *name, const char 
> **atts) {
>         if (string(name) == "value")
>                 std::cout << "Var name" << atts[1] << std::endl;
> }
>
> now how can associate to the tag, the text value?
>
>
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>




More information about the Expat-discuss mailing list