[Expat-discuss] Re: Beginner Question

Kev Buckley k.buckley at lancaster.ac.uk
Fri Aug 15 11:16:21 EDT 2003


Hi.

As well as the start and end handlers for a pair of tags, you need to
specify a char handler for the text (data ?) in between tags.

Presumably, your start handler would have tracked the fact that you
are in the "chain"

...<head><ut>

at the point that the char handler returns the string "F" to your
application. You then extract the string with the char handler and,
because you've kept track of where you are, you store it wherever it
should go.

The examples in the Expat source tarball detail this. The docs make it
even clearer as you get to see just how many handlers there are !

Kevin

> Pants and price are just attributes of name. But what if you have
> something like this the following:
>  
> <head>
>     <locale>en_US</locale>
>     <form>MEDIUM</form>
>     <ut>F</ut>
>     <ud>mi</ud>
>     <us>mph</us>
>     <up>in</up>
>     <ur>in</ur>
>   </head>
>  
> While parsing I know when I have found the element ut for example.
>  
> Having found the tag <ut> in the 
> startElement(void *userData, const char *name, const char **atts)
> function how do I get the value F?
>  
>  
> In the startelement handler I have the following code. What I don't
> under stand is where is the data "F" in the above given example?
>  
> if(strcmp( el, "ut" ) == 0 )
>  {
>         printf("  found %s", el);
>         printf("\n");
>  }
>  
> Maybe I am missing the use of a handler or something simple.
>  
> Sorry if this is a stupid question.
>  
> Thanks,
>  
> Steve
>  
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
> 


-- 
Regards,

----------------------------------------------------------------------
*  Kevin M. Buckley              e-mail: K.Buckley at lancaster.ac.uk   *
*                                                                    *
*  Systems Administrator                                             *
*  Computer Centre                                                   *
*  Lancaster University          Voice:  +44 (0) 1524 5 93718        *
*  LANCASTER. LA1 4YW            Fax  :  +44 (0) 1524 5 25113        *
*  England.                                                          *
*                                                                    *
*  My PC runs Linux/GNU, you still computing the Bill Gate$' way ?   *
----------------------------------------------------------------------





More information about the Expat-discuss mailing list