Re: how to use XML_StopParser from within a handler?
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
> Hi, > > I've looked in reference.html and the mailing list but can't find an > answer to this basic question. My application traverses an XML document > until it finds what it's looking for, at which point it's done. I.e. > there's no point continuing to parse once that's been found, and the > section it's looking for can occur anywhere in the document. I could > just set a flag and abandon parsing the next time XML_Parse() returns > but according to the API it seems like XML_StopParser (with resumable=0) > is the "right" thing to do, presumably followed by XML_ParserFree once > XML_Parse returns. > > The doc for XML_StopParser says it should be invoked from a callback > handler. But its signature indicates it takes a pointer to the parser > object and that object is not presented to the handler. So how am I to > use XML_StopParser from within a callback? Must I make the parser object > static? No, that is what the userData pointer is for. It points to memory managed by your app, where you can store the parser reference. Karl