×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    May 2009
    Posts
    63

    How can we read the XML file saved in Mobile.

    Hi,

    What I want to do is

    I want to download the XML file or received some data in a file (probably an XML or txt file) on my mobile through web and I want to save this XML File in mobile. Now I want to read this file from J2ME application and process the data contained in the file.

    My problem is:
    1. How can we save the xml file in the general location. Means general directory so that I am able to read that xml file from that location for every vendor such as nokia, sony.
    2. I want to read this file. So how can we read this file from J2ME application and process the data contained in the file.

    Is it possible in J2ME,Can somebody please provide me some sample code on this or some related links.

    Thanks
    Rahul

  2. #2
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    106

    Re: How can we read the XML file saved in Mobile.

    It is possible if you phone supports FileConnection API.
    Please read this first and let me know if you still have any questions.

  3. #3
    Regular Contributor
    Join Date
    May 2009
    Posts
    63

    Re: How can we read the XML file saved in Mobile.

    Hi,


    Thanks for the link.
    It is really helpful link.

    But how can we read the xml file. Means in xml file there are xml tags and we need some kxml parser to read. So what I have to do from the start to read the xml.

    please guide me so I am able to read the xml file.


    Thanks
    Rahul

  4. #4
    Regular Contributor
    Join Date
    May 2009
    Posts
    63

    Re: How can we read the XML file saved in Mobile.

    Quote Originally Posted by Unit1ed View Post
    It is possible if you phone supports FileConnection API.
    Please read this first and let me know if you still have any questions.
    Hi,


    Thanks for the link.
    It is really helpful link.

    But how can we read the xml file. Means in xml file there are xml tags and we need some kxml parser to read. So what I have to do from the start to read the xml.

    please guide me so I am able to read the xml file.


    Thanks
    Rahul

  5. #5
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: How can we read the XML file saved in Mobile.

    Hi,

    You can use JSR-172 and the XML Parser Optional Package or go for external (not embedded, standard) parser like kXML below. There are other parsers too, look for them using google.

    http://www.ibm.com/developerworks/library/wi-parsexml/

    Br,
    Juarez Alvares Barbosa Junior - Brazil

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105
    Does your user need that XML file as file? If not and he just needs the data, I recommend to look at the RecordStore API rather than FileConnection API.

    If that file is rather big, I recommend to compress it as WBXML. This does not need to be decrompressed again. If that is still too big, compress it as usual with gzip or similiar. I guess kXML will help you. Do you really need to save it persistently? What about processing it in the heap?

    However, your question is quite generic and as you might see already, there are several ways to solve it. I do not think it is a good idea to start with sample code; better reasearch the possible alternatives and decide which way is the best.

  7. #7
    Regular Contributor
    Join Date
    Jan 2008
    Posts
    387

    Re: How can we read the XML file saved in Mobile.

    hi, as traud told you, use jsr-75 first to retrieve file path, and than use any parser to parse, there are many eg on net to parse, and even lot of thread here.
    Thanks and Regards,
    Manjul.

  8. #8
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: How can we read the XML file saved in Mobile.

    Quote Originally Posted by rahulkrishna View Post
    Hi,

    What I want to do is

    I want to download the XML file or received some data in a file (probably an XML or txt file) on my mobile through web and I want to save this XML File in mobile. Now I want to read this file from J2ME application and process the data contained in the file.

    My problem is:
    1. How can we save the xml file in the general location. Means general directory so that I am able to read that xml file from that location for every vendor such as nokia, sony.
    2. I want to read this file. So how can we read this file from J2ME application and process the data contained in the file.

    Is it possible in J2ME,Can somebody please provide me some sample code on this or some related links.

    Thanks
    Rahul
    Well to save the file to filesystem u can give option to user to save the file to his desired location. For this u can give facility of a browser to user. U can take guidance to create browser from the PDAP demo of wtk.
    Also u can read the file using same logic.Its better to browse the filesystem then using a particular directory for reading and writing the data.

    For reading the text file or xml file or any file u have to use FILE CoNneCtiOn ApI. To display the contents of xml file u have to take use of some XML parser to parse the xml file.
    thanks,
    jitu_goldie..

    KEEP TRYING..

Similar Threads

  1. Problem with pyobfuscate
    By JOM in forum Symbian
    Replies: 3
    Last Post: 2008-06-20, 22:47
  2. Replies: 0
    Last Post: 2007-10-11, 09:19
  3. Replies: 0
    Last Post: 2007-07-15, 23:06
  4. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46

Posting Permissions

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