If I have an XML element such as:
<title>this is a title</title>
The text is very easy to get using XMLStreamReader.getElementText()
. However, if I run into an element like this, I cannot figure out how to get the text:
<title>this is a <othertag>title with another</othertag> tag inside of it</title>
I wasn't even sure if that was valid XML, but it seems to pass the W3C validator I tried it on. According to the API docs, you can't use getElementText()
to get the text if you are going to encounter another START_ELEMENT
event inside. So... what can you use?