阅读少于一分钟
Let's read the tags content in following XML snippet:
<tag>foo&boo</tag>
with the single call to (supposing everything is initialized correctly up to this point):
xmlStreamReader.getText()
We expect the string 'foo&boo' as result, right?
No! The return value is (or may be) just 'foo'. XMLStreamReader#getText() is allowed to break the text content into several chunks! For above example, we have 3 xml events (of type CHARACTER) sent one after another: foo, &, boo.
Use getText() in a loop to concatenate chunks and retrieve the whole text content. Or use getElementText() :)
Related Assets...
未找到结果
More Blog Entries...
Yasuyuki Takeo
十月 10, 2026
Community
Company
Feedback


