XMLPullParser, multiple tags



PROBLEM


I have additional tag in my XML, which I cannot get rid off. I did solve to problem of reading constructions like this in my parser BUT this one is not willing to cooperate.



<cell>
<text><c>arise</c></text>
<sound>O_000.mp3</sound>
</cell>


As you can see there is this dreadful <text><c> which is source of all of my problems.


Now when the parsing get to that point in my XML, the parser is going like this:



XmlPullParser xpp = factory.newPullParser(); //so will know what xpp is
xpp.setInput(new StringReader(xmlTxt));

xpp.getEventType() - > XmlPullParser.START_TAG -> xpp.next() -> xpp.getText() [it returns null] ->
-> xpp.getEventType() - > XmlPullParser.TEXT -> xpp.next() -> xpp.getText() [getting 'arise' text] ->
-> xpp.getEventType() - > XmlPullParser.END_TAG -> [getting </c> end tag] ->
-> xpp.getEventType() - > XmlPullParser.END_TAG -> [getting </text> end tag]


As you can see in the step by step above I am missing the <c> START_TAG and I don't know why its happening. Its like the first xpp.next() that returns null is eating my START_TAG along with it.


If you have any questions or something is unclear please add a comment and I will do my best to answer/explain.


Thanks for help!


No comments:

Post a Comment