Re: Clarification on the behavior of the text handler
Karl Waclawek <[email protected]>
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
Suresh Kumar J wrote: > Hi there! > > I wanted to clarify on the behavior of the text handler. > > Below is the description for the XML_SetCharacterDataHandler API: > ------------------------------------------------------------------------ > The string your handler receives is NOT zero terminated. You have to > use the length argument to deal with the end of the string. A single > block of contiguous text free of markup may still result in a sequence > of calls to this handler. In other words, if you're searching for a > pattern in the text, it may be split across calls to this handler. > ------------------------------------------------------------------------ > > Lets say that I am passing the complete XML document to the XMLParse() > API in a single shot. So If I register a character data handler for > handling the element data then would I be getting the complete element > text data in a single call to my registered text handler. In other > words, can I safely assume that the first call to the text handler > routine would contain the complete text data?. Even when I pass the > complete XML document to the XMLParse() in a single shot, can the text > data be split across the calls to the data handler?. > > Any inputs in this regard would be helpful. > Nick is correct - you cannot assume single call-backs. For instance, any line break in element content will cause multiple call-backs, IIRC. Karl