Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor kusumat's Avatar
    Join Date
    Oct 2008
    Location
    Bangalore,India
    Posts
    129
    Hi,

    Is it possible to access xml file directly from java class in j2me application without using servlets.

    one traditional way which i know is append xml strings in java class and parsing.


    FYI - I am using eclipse.

    Regards,
    Kusuma

  2. #2

  3. #3
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Quote Originally Posted by kusumat View Post
    Hi,

    Is it possible to access xml file directly from java class in j2me application without using servlets.
    Servlets are only related if and only if the XML file is on some URL on the server and you wanna that XML.IN this case you can use the servlet or any other server side technology which will return you the XML as soon as you hit that URL.

    If you dont wanna use servletI in your case) that means you are not planning to use the server side implementation for the XML handling and hence you can either put the XML on the file system of the device or you even can save the xml in the RMS.Please note that the size of the RMS is much limited and depends upon the device.
    You can use either of the two which suited to your need.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  4. #4
    Registered User bhanuchandar.k's Avatar
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868
    Hi Kusuma,

    Can you give little more clarity about what is your problem ? If you tell clearly then it will be easier to to give the solution.

  5. #5
    Regular Contributor kusumat's Avatar
    Join Date
    Oct 2008
    Location
    Bangalore,India
    Posts
    129
    Hi Bhanu,


    I have a j2me app which retrieves xml data using httpconnection.

    But i dont want to use http instead i want to get it from an xml file exist in my application only.

    And the parsing would same as aml data parsing recieved from server.

    Regards,
    kusuma

  6. #6
    Regular Contributor kusumat's Avatar
    Join Date
    Oct 2008
    Location
    Bangalore,India
    Posts
    129
    Hi raj_J2ME ,

    The way you suggested is comprehensive but my requirement is not accessing xml data from device data but from like file exists in application along with .java files in the different package file.

    Regards,
    Kusuma

  7. #7
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Repeat the post-3 of this discussion.
    Why .java files?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  8. #8
    Registered User bhanuchandar.k's Avatar
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868
    Hi Kusuma,

    Read the xml file as the an inputstream and construct the string with that input stream, If you have any XML parsers then you can directly give the input stream to the XML parser that parser will handle.

    InputStream in = this.getResourceAsStream("/file.xml");

  9. #9
    Registered User lonstard's Avatar
    Join Date
    Dec 2012
    Posts
    1
    Hi to all of you..
    I am developing an j2me application and I already finished, but can somebody tell me how to store the data that I write in application in a xml file or other format.. can somebody find me a class
    with the code there like an example.. hope I will have any answer
    all the best!

  10. #10
    Nokia Developer Champion im2amit's Avatar
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    2,917
    Quote Originally Posted by lonstard View Post
    Hi to all of you..
    I am developing an j2me application and I already finished, but can somebody tell me how to store the data that I write in application in a xml file or other format.. can somebody find me a class
    with the code there like an example.. hope I will have any answer
    all the best!
    j2me provides RecordStore - in which you can store each line of your application data as a separate row - for more details refer to API doc for RecordStore
    Example - http://www.developer.nokia.com/Commu...re_Data_in_RMS

    For writing data to file - you need tp use FileConnection API (JSR-75) and you need user's permissions for the same - hence using RMS is better option.
    Example - http://www.developer.nokia.com/Commu...ile_in_Java_ME
    thanks,
    ~Amitabh
    (Poster of the Month -Dec'12)
    Follow me on my blog for Innovative Mobile Apps

Similar Threads

  1. How to load local XML file in Flash Lite that is embedded in a WRT Widget?
    By kvirtanen in forum [Archived] Flash Lite on Nokia Devices
    Replies: 3
    Last Post: 2010-04-06, 10:14
  2. Problems with MBM and MBG file
    By rsiudak in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 5
    Last Post: 2010-02-19, 02:23
  3. How to view File Content from the J2ME application?
    By neeraja.nokia in forum Mobile Java General
    Replies: 4
    Last Post: 2009-05-30, 23:13
  4. Regarding BMCONV
    By sanah007 in forum Symbian C++
    Replies: 2
    Last Post: 2009-05-26, 12:47
  5. How can the WAP browser communicate to J2ME application?
    By hbfornies in forum Mobile Java General
    Replies: 20
    Last Post: 2007-03-02, 16:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved