Parsing xml getting XmlPullParserException

1.4k Views Asked by At

I am getting an error while parsing xml file in J2ME

below is the error

         org.xmlpull.v1.XmlPullParserException: precondition: START_TAG (position:END_TAG </ABC>@4:11 in java.io.InputStreamReader@e9eeb02a) 
       - org.kxml2.io.KXmlParser.exception(), bci=44
       - org.kxml2.io.KXmlParser.nextText(), bci=11
       - hello.Test.commandAction(Test.java:85)
       - javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleCommandEvent(), bci=296
       - com.sun.midp.lcdui.DisplayEventListener.process(), bci=467
       - com.sun.midp.events.EventQueue.run(), bci=182
       - java.lang.Thread.run(), bci=5

below is the code

       this.in = getClass().getResourceAsStream("/"+
                this.engWord.getString().trim().toUpperCase().charAt(0)
                        + ".xml");
        this.is = new InputStreamReader(this.in);
        this.parser.setInput(this.is);
        this.parser.nextTag();
        this.parser.require(2, null, "Test");

And Below is the xml file

                <TEST>
                  <ABC>
                     a deux
                  </ABC>
                    <DEF>
                     MOTHER 
                    </DEF>
                 </TEST>
1

There are 1 best solutions below

0
On

The problem is that the tag "Test" does not match "TEST". The require method works with case sensitve.