I'm having trouble parsing XML using Woodstox on k...
# getting-started
k
I'm having trouble parsing XML using Woodstox on kotlin, I'm following a java tutorial ( https://www.baeldung.com/java-stax ) that otherwise seems to work but trying to read the actual values inside XML tags like:
Copy code
val something = nextEvent.asCharacters().data
fails with an exception:
Exception in thread "main" java.lang.ClassCastException: com.ctc.wstx.evt.CompactStartElement cannot be cast to javax.xml.stream.events.Characters
If I check the even with isCharacters it returns false even though it most definitely contains a value. How do I get that value?
k
not sure how is this kotlin related. but I assume you are still in startElement and not in "body" element
k
thanks, that works, I didn't expect the tutorial to be wrong