问题
I am writing a blackberry application where I want to store the data returned by a web service in my BB device. Earlier I was going to use SQLite for storing the data in mobile but as I googled and also did programming using SQLite and found that some BB devices don't support SQLite library and fail to create the database. Then I decided to keep the data returned by webservice in a XML format on my BB device.
I just want to know is there any method or way in blackberry through which i can parse the data stored in XML, update it, or directly access a particular record stored in the XML instead of traversing the whole XML n times and finding the matched record.
Please guide me as I am new to storing data in BB device. Is the approach which I am thinking to store data in XML right or shall I use something else?
Yogesh Chaudhari
回答1:
Hi there are many options depending upon your requirement and choice:
1) RMS - better to use if u r using midlets 2) Persistence - for cldc 3) Sqlite - devices supporting OS 5.0 or later 4) File system - any device
Persistence: when u get your response in xml try to parse and fetch the components from it, save in a vector and persist that vector in device.You can fetch data from it any time.
File System - write your contents in a file and save in SDCard when you want read that file and use its contents.
You can download this book that can guide you well through code and concepts too
1) http://www.freshwap.net/3a8/dl/Apress+Beginning+BlackBerry+Development+Nov+2009+Pdf (not free) 2) https://stackoverflow.com/questions/194812/list-of-freely-available-programming-books
these books can guide you in detail depending upon ur requirement Moreover u can search stack overflow for similar questions and get variety of answers
来源:https://stackoverflow.com/questions/4543525/store-xml-update-record-in-xml-retrieve-a-specific-record-in-xml-stored-on-bb