logo       

KXML parser is runtime Array out of bound exception: msg#00005

java.enhydra.kxml

Subject: KXML parser is runtime Array out of bound exception

Hello,
I am trying to use kxml's wbxml parser. I intend to use XmlPullParser interface only. I am seeing two issues
1. I am not getting any start tag event
2. Runtime array out of bound exception is being thrown from nextImpl() method of parser.
Any help would be greatly appreciated. I am attaching the sample code. If I am doing something wrong, would you please attach the sample code. Thanks.
 
try {
   WbxmlParser xpp = null ;
    XmlPullParserFactory factory =
              XmlPullParserFactory.newInstance(
                 "org.kxml2.wap.WbxmlParser",
                 Class.forName("org.kxml2.wap.WbxmlParser"));
    xpp = (WbxmlParser) (factory.newPullParser());
         if (xpp instanceof  org.kxml2.wap.WbxmlParser) {
            System.out.println ("Setting the wbxml tag table");
            xpp.setTagTable(0, MyWbxml.tagTable);
            xpp.setAttrStartTable (0, MyWbxml.attrStartTable);
            xpp.setAttrValueTable (0, MyWbxml.attrValueTable);
            System.out.println ("All setup done. ");
         } else {
            System.out.println ("Not wbxml parser. ");
         }
      } catch (XmlPullParserException e) {
         throw new DRMException("XML parsing error");
      } catch (ClassNotFoundException e) {
         throw new DRMException("Class not found xml parsing error");
      }
 }

 try {
         xpp.setInput(is, encoding);
         int eventType = xpp.getEventType();
         do {
            if (eventType == XmlPullParser.START_TAG) {
            System.out.println ("start tag " + eventType + " prefix " + xpp.getPrefix() + " tag " + xpp.getName() );
            /* processStartTag(); */
            } else if (eventType == XmlPullParser.END_TAG) {
            System.out.println ("end tag " + eventType + " prefix " + xpp.getPrefix() + " tag " + xpp.getName() );
               /* processEndTag(); */
            } else if (eventType == XmlPullParser.TEXT) {
            System.out.println ("text tag " + eventType + " prefix " + xpp.getPrefix() + " tag " + xpp.getName() );
               /* processText(); */
            }
            eventType = xpp.next();
 
         } while (eventType != XmlPullParser.END_DOCUMENT);
 
      } catch (XmlPullParserException e) {
         e.printStackTrace () ;
         
      }
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise