[Expat-discuss] not well-formed (invalid token)

Dan Rosen dr at netscape.com
Fri May 30 12:12:12 EDT 2003


Subhashini,

I didn't receive the full text of your reply to my post (only the part 
quoted in Karl's reply) but here's what I tend to do:

>>Thanks for the response. The problem is solved. But I see that the character handler
>>is called more than once even though I have just one block of word in between my tags. 
>>The consecutive calls to character handler do not have any text associated with them.

You'll get multiple character callbacks in a number of instances. Line 
breaks are one such case, entity normalization and CDATA blocks also 
cause this. What I tend to do in my own code is coalesce the multiple 
character callbacks into one (with logic like "keep adding to my string 
until I get some other callback"), and pass the resulting complete 
string on to my application.

Hope this helps,
Dan




More information about the Expat-discuss mailing list