i have SAXParser to parse xml feed, for some element there are whitespace characters embedded like
开发者_StackOverflow <category>Beauty, Spas, & Salons</category>
and the parser only extract 'Beauty' from 'category' instead of 'Beauty, Spas, & Salons', how can i force it to extract the whole string? thanks
The parser is almost certainly giving you the whole string but it is over multiple calls to characters(). characters() will be called any number of times to deliver the contents of an element; it could be one character at a time. You need to keep a String (or StringBuilder...) and add to it each time characters() is called. You don't know you have the whole element content until endElement() is called.
精彩评论