xml-parsingstaxwoodstox

Woodstox stax empty characters


i have an element like this

<name></name>

but in my switch statement

case XMLEvent.CHARACTERS:{
 ...
}

is not getting called. any idea how I can get this event?


Solution

  • There is no character content to report, so you will not get CHARACTERS event. You will need to work around this; you can, for example, use XMLStreamReader.getElementText() when stream points to START_ELEMENT. Calling that method would return empty String in your case, and move stream to point to matching END_ELEMENT.