Android的数据存储在XML [英] Android data storage in xml

查看:176
本文介绍了Android的数据存储在XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网络平台,为我建立一个应用程序存储数据。该网络平台是建立与Ruby on Rails和主要的应用是Android。我很好奇地想知道有关存储我的数据在一个XML文件(Android应用程序)的任何性能问题。 Eventualy我的web应用程序的数据库都将有大约2000个条目(如文章/文章分类 - >文章 - 内容,描述,标题,图片路径)。

I have a web platform that stores data for an application that I am building. The web platform is built with Ruby on Rails and the main app is for Android. I am curious to know about any performance issues of storing my data in an XML file (for the android app). Eventualy my database in the web app is going to have about 2000 entries (like articles / Article category -> Article - content, description, title, image path).

是更好地使用SQLite或存储我的数据的XML文件?

Is it better to use SQLite or an XML file to store my data?

感谢您。

推荐答案

当数据集较大, SQLiteDatabase 是最好的选择。 CRUD操作数据库执行会比解析XML文件数据retrival快得多。

When data set is larger, SQLiteDatabase is the best option. CRUD operations performed on database would be much faster than parsing the xml files for data retrival.

要更具体地,数据库具有的SQL的优势,因为它的查询语言,关系理论为基础,并且由供应商年优化

To be more specific, database has the advantage of SQL as its query language, relational theory as its underpinnings, and years of optimization by vendors.

XML比与它一起携带它自己的元数据的数据格式更小。您可以使用XPath查询它序列化到从磁盘,使用标准的解析器解析它到内存中,并且,但它不是配置或优化,以相同程度的SQL。

XML is little more than a data format that carries its own meta-data along with it. You can serialize it to and from disk, parse it into memory using standard parsers, and query using XPath, but it's not configurable or optimized to the same degree as SQL.

XML可以作为配置格式或有线协议或简单的序列化到磁盘上是有用的,但它不是一个完整的持久性技术。

XML can be useful as a configuration format or a wire protocol or simple serialization to disk, but it's not a full-fledged persistence technology.

有很多NoSQL的替代品( JasDB ),如果您不想使用关系数据库。但我不会考虑原始XML作为其中一员。

There are lots of NoSQL alternatives (JasDB) if you would rather not use a relational database. But I wouldn't consider raw XML as one of them.

此外,使用XML作为用户数量的增长可能会变得难以管理。从一开始使用数据库确保你有空间来扩大和发展作为你的用户群的增加。

Also, using XML may become unmanageable as the number of users grows. Using a database from the start ensures you have the room to expand and develop as your user base increase.

这篇关于Android的数据存储在XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆