×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    22

    How to install KXML?

    Hi all
    Who can explain detaily how to install and make works kxml2.Im trying to use it but there are some errors with XmlPullParser.I've installed latest version of Eclipse.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: How to install KXML?

    You need to add kXML's JAR file as a library, to your projects build path (right-click on the project, and look for "configure build path"). Under the "order and export" tab, make sure the kXML library has a "tick" next to it.

    Graham.

  3. #3
    Registered User
    Join Date
    Jul 2010
    Posts
    22

    Re: How to install KXML?

    Thanks man, i think that the problem of installing kxml now has gone,but there is new one.

    "org.xmlpull.v1.XmlPullParserException: PI must not start with xml (position:unknown @1:5 in java.io.InputStreamReader@1cb37664) "

    Any idea for this?!

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: How to install KXML?

    I googled for "PI must not start with xml", and this is the first hit I found. Does it help?

    Graham.

  5. #5
    Registered User
    Join Date
    Jul 2010
    Posts
    22

    Re: How to install KXML?

    Yes, it was helpful for that man but again there is new one.

    " java.lang.NullPointerException
    at com.sun.cldc.i18n.Helper.getStreamReader(+15)
    at com.sun.cldc.i18n.Helper.getStreamReader(+7)
    at java.io.InputStreamReader.<init>(+9)
    at com.parser.Tester.<init>(+46)
    at java.lang.Class.runCustomCode(+0)
    at com.sun.midp.midlet.MIDletState.createMIDlet(+34)
    at com.sun.midp.midlet.Scheduler.schedule(+52)
    at com.sun.midp.main.Main.runLocalClass(+28)
    at com.sun.midp.main.Main.main(+80)"

    When i click to the error it takes me to this line of codes "InputStreamReader is = new InputStreamReader(in);"

    If you have any working project with kxml2 please post just for trying,maybe it will be useful to find out where is the problem.

  6. #6
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: How to install KXML?

    you did initilaize the in variable you are using there right ? so it's value is not null ?
    Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them.

  7. #7
    Registered User
    Join Date
    Jul 2010
    Posts
    22

    Re: How to install KXML?

    Yes i did.Take a look at this example:

    HTML Code:
    package com.parser;
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    
    import org.kxml2.io.KXmlParser;
    import org.kxml2.kdom.Document;
    import org.xmlpull.v1.XmlPullParserException;
    
    public class Tester extends MIDlet
    {
    	KXmlParser parser = null;
    	public String url = "/book.xml";
    	public Tester()
    	{
    		try
    		{
    			InputStream in = this.getClass().getResourceAsStream(url);
    			InputStreamReader is = new InputStreamReader(in);
    			parser = new KXmlParser();
    			try
    			{
    				parser.setInput(is);
    			}
    			catch (XmlPullParserException e1)
    			{
    				// TODO Auto-generated catch block
    				e1.printStackTrace();
    			}
    						
    		}
    		catch(IOException ioe)
    		{
    			System.err.println(ioe);
    		      ioe.printStackTrace();
    		      parser = null;
    		      doc = null;
    		      return;
    		}
    	}
    
    	protected void destroyApp(boolean unconditional) throws MIDletStateChangeException
    	{
    	}
    
    	protected void pauseApp()
    	{
    	}
    
    	protected void startApp() throws MIDletStateChangeException
    	{
    	}
    
    }
    Last edited by xmenus; 2010-07-16 at 19:50.

  8. #8
    Registered User
    Join Date
    Jul 2010
    Posts
    22

    Re: How to install KXML?

    Solved.I've found the solution.Thanks to all especially to grahamhughes .
    Regards.

  9. #9
    Registered User
    Join Date
    Oct 2012
    Posts
    2

    Re: How to install KXML?

    heyy hii...
    I am new to j2me.....this is my first application i am developing using j2me.....
    and in this i need to extract data from xml file and display it on screen....and i am using KXML for this in NetBeans IDE...
    but i am unable to access that file....

    public String emp = "/dictxml2.xml";
    parser = new XmlParser(new InputStreamReader(this.getClass().getResourceAsStream(emp)), 300);

    here in the second line i get a NullPointerException....i kept this file in my source package,then also its throwing this Exception...
    plz tell me whr did u keep the file which you accessed and how you solved it....plz...it would be a grt help for me!!

    here is the full Exception detail...

    TRACE: <at java.lang.NullPointerException>, startApp threw an Exception
    java.lang.NullPointerException
    at com.sun.cldc.i18n.Helper.getStreamReader(), bci=12
    at com.sun.cldc.i18n.Helper.getStreamReader(), bci=4
    at java.io.InputStreamReader.<init>(InputStreamReader.java:57)
    at myPackage.MyFirstApplication.startApp(MyFirstApplication.java:87)
    at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
    at com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
    at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
    at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
    at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
    at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
    at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26

  10. #10
    Registered User
    Join Date
    Oct 2012
    Posts
    2

    Re: How to install KXML?

    Quote Originally Posted by xmenus View Post
    Solved.I've found the solution.Thanks to all especially to grahamhughes .
    Regards.
    heyy hii xmenus...
    I am new to j2me.....this is my first application i am developing using j2me.....
    and in this i need to extract data from xml file and display it on screen....and i am using KXML for this in NetBeans IDE...
    but i am unable to access that file....

    public String emp = "/dictxml2.xml";
    parser = new XmlParser(new InputStreamReader(this.getClass().getResourceAsStream(emp)), 300);

    here in the second line i get a NullPointerException....i kept this file in my source package,then also its throwing this Exception...
    plz tell me whr did u keep the file which you accessed and how you solved it....plz...it would be a grt help for me!!

    here is the full Exception detail...

    TRACE: <at java.lang.NullPointerException>, startApp threw an Exception
    java.lang.NullPointerException
    at com.sun.cldc.i18n.Helper.getStreamReader(), bci=12
    at com.sun.cldc.i18n.Helper.getStreamReader(), bci=4
    at java.io.InputStreamReader.<init>(InputStreamReader.java:57)
    at myPackage.MyFirstApplication.startApp(MyFirstApplication.java:87)
    at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
    at com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
    at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
    at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
    at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
    at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
    at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26

Similar Threads

  1. How to use the kxml parser
    By dhiraj.deka in forum Mobile Java General
    Replies: 7
    Last Post: 2009-11-03, 16:16
  2. using kxml parser
    By smart@gayu in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2007-06-10, 18:07
  3. kxml and NDS
    By shantanu_chawla in forum Mobile Java General
    Replies: 1
    Last Post: 2005-11-30, 14:23
  4. kXML 中文的問題
    By ymlan in forum [Archived] Other Programming Discussion 关于其他编程技术的讨论
    Replies: 1
    Last Post: 2005-07-08, 03:29
  5. kXML 2 problem
    By markber in forum Mobile Java General
    Replies: 4
    Last Post: 2003-07-07, 14:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •