[Expat-discuss] how can I get the "value" ?

Michael B. Allen miallen at eskimo.com
Tue Feb 25 16:09:03 EST 2003


On Mon, 24 Feb 2003 08:54:54 -0300
"Sergio Barbosa Villas-Boas" <villas at del.ufrj.br> wrote:

> Hi, all
> 
> I'm learning expat.
> I'm trying to parse a simple xml file. Something like below.
> 
> <something>
> 	<data attrib="oneData" attrib2="oneData2">value</data>
> </something>
> 
> I wrote a startElement function like the prototype below.
> void startElement(void *data, const XML_Char *el, const XML_Char **attr);
> 
> I can get "attrib" and "attrib2" (and "oneData" and "oneData2") from the
> "attr" parameter.
> But how can I get the "value" ?

After startElement is called the function registered with
XML_SetCharacterDataHandler will be called with the enclosed text. Then
endElement or whatever end tag handler you registered will be called. See
the examples and read the tutorial on xml.com.

Mike

-- 
A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and, more important, to tasks that have not
yet been conceived. 



More information about the Expat-discuss mailing list