Re: KXML parser is runtime Array out of bound exception
Stefan Haustein <[email protected]> Wed, 07 Apr 2004 12:19:21 +0200
| Newsgroups | gmane.comp.java.enhydra.kxml |
|---|---|
| Message-ID | <[email protected]> |
Hi,
are you using the latest version from CVS? There have been a lot of fixes in the
WBXML part that are not included in the release version yet.
Best,
Stefan
Jain Sanjay-E11733 wrote:
> 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 () ;
>
> }
>
>