[Expat-discuss] Simple question

Stefan A Letz stefan.letz at de.ibm.com
Tue Jan 25 11:13:15 CET 2005


You're right. I took a look at xmlparse.c: XML_ParserReset sets the 
user data as well as the handlers to NULL, thus you have to free any
memory associated with the user data before calling the function 
(!), and set all your handlers again afterwards.
 
The documentation is somewhat misleading and should be modified.
 
Stefan.


> "Sebastian Bello" <sebastian at inswitch.us> 
> 01/24/2005 04:47 PM
> 
> To
> 
> Stefan A Letz/Germany/IBM at IBMDE
> 
> cc
> 
> Subject
> 
> Re: [Expat-discuss] Simple question
> 
> Stefan,
> 
> yes, I read it. When parsing the second message I don't get any callback
> executed, just as if the handlers weren't set or the xml was empty.
> If I do all the initialization again it works fine. Do you think this 
has to
> do with the user data?
> Thanks,
>     Sebastian-
> 
> PD: should I reply to you or to the list?
> 
> ----- Original Message -----
> From: "Stefan A Letz" <stefan.letz at de.ibm.com>
> To: "Sebastian Bello" <sebastian at inswitch.us>
> Sent: Monday, January 24, 2005 1:18 PM
> Subject: Re: [Expat-discuss] Simple question
> 
> 
> >
> >
> >
> >
> > Hello Sebastian,
> >
> > as stated in the documentation of this function, after 
XML_ParserReset()
> > has been called the parser is ready to start parsing a new document. 
So,
> > your user data and your handlers are still set.
> >
> > Stefan Letz.
> >
> >
> >
> >
> >
> >
> >
> >              "Sebastian Bello"
> >              <sebastian at inswit
> >              ch.us>  To
> >              Sent by:
> >              expat-discuss-bou         <expat-discuss at libexpat.org>
> >              nces at libexpat.org  cc
> >
> >
> >              01/24/2005 02:54
> >              PM
> >
> > Subject
> >                                        [Expat-discuss] Simple question
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Hi list,
> >
> > I'm writing a simple application that parses XML messages. As part of 
the
> > initialization I invoke
> >     XML_ParserCreate
> >     XML_SetUserData
> >     XML_SetStartElementHandler
> >     XML_SetEndElementHandler
> >     XML_SetCharacterDataHandler
> >
> > I use XML_Parse to do the parsing.
> > The question is if I have to do all this initialization before each 
new
> > message parsing, or if it is enough calling XML_ParserReset after each 
XML
> > parsed. Am I missing something?
> > Thanks,
> >     Sebastian-
> > _______________________________________________
> > 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