PDA

Click to See Complete Forum and Search --> : [RESOLVED] XMLStreamReader problem in parsing an XML


oceanebelle
Nov 28th, 2008, 06:44 AM
Hi All,

I have a XMLStreamReader setup with com.ctc.wstx.stax.WstxInputFactory

the problematic XML I have has this form

<parent>
TEXT
<child1 value="A VALUE" />
<child2 value="SOME VALUE" />
</parent>



When I am at the parent event, and try to get "TEXT" using the reader.getElementText()

I get an error saying that there is no text but a Start event instead.

Are there any ways of extracting TEXT value? without having to go to the next event which is child1?

oceanebelle
Nov 28th, 2008, 07:26 AM
Ah found it.

I just need to check if the Event = XMLStreamConstants.CHARACTERS

then use getText().

:)