hi,

this is dhana. this is my first post, i am little nervous. i am developing a j2me application, i used xml file as database. so, i created a xml file and i saved it in c:\ , when i am trying to open that file in j2me, it shows error. the code is as below:

c =(StreamConnection)Connector.open("c:\\addressbook.xml");
      s = c.openInputStream();
       Reader is= new InputStreamReader(s);
      KXmlParser parser = new KXmlParser();
      Document document = new Document();
      parser.setInput(is);

i am getting arror as below:

C:\Users\DHANA\Documents\NetBeansProjects\AddressBook\src\AddressDB.java:128: unreported exception org.xmlpull.v1.XmlPullParserException; must be caught or declared to be thrown
parser.setInput(is);
C:\Users\DHANA\Documents\NetBeansProjects\AddressBook\src\AddressDB.java:129: unreported exception org.xmlpull.v1.XmlPullParserException; must be caught or declared to be thrown
document.parse(parser);
2 errors
C:\Users\DHANA\Documents\NetBeansProjects\AddressBook\nbproject\build-impl.xml:368: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 3 seconds)

so, can anyone solve my problem. thanks in advance.

You have to wrap it in a try-catch block like it tells you.

I think c:\\ will need to be c:\ too if its a local file, otherwise it'll need to be a valid protocol.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.