[Expat-discuss] Fw: Event callbacks for every Tag
Régis St-Gelais (Laubrass)
regis.st-gelais at laubrass.com
Thu Feb 22 17:45:42 CET 2007
Private email I got from Mandeep Ahuja.
Just to let the list know that his issue is resolved.
From: Mandeep Ahuja
To: "Régis St-Gelais (Laubrass)"
Sent: Thursday, February 22, 2007 11:27 AM
Subject: Re: [Expat-discuss] Event callbacks for every Tag
thats awesome, it does the job
thanks a lot guys
mandeep
>Régis St-Gelais (Laubrass) wrote:
>
>
> ----- Original Message -----
>
> *From:* Mandeep Ahuja <mailto:ahuja at aksysnetworks.com>
> *To:* expat-discuss at libexpat.org <mailto:expat-discuss at libexpat.org>
> *Sent:* Wednesday, February 21, 2007 7:27 PM
> *Subject:* [Expat-discuss] Event callbacks for every Tag
>
> Hi, I am new user of the expat library. My application requires
> different code to be run on different xml tags when they are found
> and on the fly. I have learned expat is event driven, but only one
> function is calledback on every tag found (endElement). My
> question is, can expat callback different functions based on tag
> found, meaning a unique callback for every tag. Is that possible?
> Please help me out
>
> You can do something like that:
> In the unic element_end callback, you multiplex your different
> callbacks based on the tag.
>
> static void XMLhndl_ElementEnd(void *userData, const char *strElement)
> {
> if (strcmp(strElement,"TAG1")==0)
> {
> // call your callback for TAG1 here
> return;
> }
>
> if (strcmp(strElement,"TAG2")==0)
> {
> // call your callback for TAG2 here
> return;
> }
>
> }
>
> Regis St-Gelais
> www.laubrass.com
More information about the Expat-discuss
mailing list