存储 XML、更新 XML 中的记录、检索存储在 BB 设备上的 XML 中的特定记录
我正在编写一个黑莓应用程序,我想在其中存储 我的 BB 设备中的 Web 服务返回的数据。早些时候我打算 使用 SQLite 在移动设备中存储数据,但当我用 google 搜索并使用 SQLite 进行编程时发现 部分BB设备不支持SQLite库,无法创建数据库。然后我决定保留 我的 BB 设备上的 webservice 以 XML 格式返回的数据。
我只是想知道黑莓有没有什么方法或途径 我可以解析 XML 中存储的数据、更新它或直接访问 存储在 XML 中的特定记录,而不是遍历整个 XML n 次并查找匹配的记录。
请指导我,因为我是在 BB 设备中存储数据的新手。是采用哪种方法 我正在考虑将数据存储在 XML 中,还是应该使用其他内容?
约格什·乔杜里
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您好,根据您的要求和选择,有很多选项:
1) RMS - 如果您使用 midlet,则更好使用
2)持久化——对于cldc
3) Sqlite - 支持 OS 5.0 或更高版本的设备
4) 文件系统 - 任何设备
持久性:当您在 xml 中收到响应时,尝试解析并从中获取组件,保存在向量中并将该向量保留在设备中。您可以随时从中获取数据。
文件系统 - 将您的内容写入文件并在您想要读取该文件并使用其内容时保存在 SDCard 中。
您可以下载这本书,它也可以指导您很好地了解代码和概念
1) http://www.freshwap.net/3a8/dl/Apress+Beginning+BlackBerry+Development+Nov+2009+Pdf(非免费)
2)https://stackoverflow.com/questions/194812/list-of-freely- available-programming-books
这些书籍可以根据您的要求详细指导您
此外,您可以在堆栈溢出中搜索类似的问题并获得各种答案
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