Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android data storage in xml

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). Eventually my database in the web app is going to have about 2000 entries (like articles / Article category -> Article - content, description, title, image path).

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

like image 818
manosagent Avatar asked Feb 13 '23 20:02

manosagent


1 Answers

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.

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 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 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.

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.

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.

like image 61
Chintan Soni Avatar answered Mar 05 '23 05:03

Chintan Soni