views:

117

answers:

1

Hi All,

I am working on android, and I am parsing a huge XML file. so all the time I need to get some data from that XML file, which is making the application very slow.

Is there any way that I can create a data set/record set/result set of the XML file

so that later I can get the data from the newly created set.

and also how to read that set :)

thanks alot!!

regards..

kai!!

A: 

To begin with, any application that often needs to search huge XML files are going to be somewhat slow.

I don't know what's in your XML file, but if it is suited for storing in SQL database, that might be an idea. Read it once, put it in a database and then searching for stuff should be a lot faster (given the right indexes, of course)

If the data is not too big to keep in memory all at once, you might be able to build a data structure in memory that you can easily find stuff in.

It's really tricky to give a good answer without knowing a little bit more about what sort of data it is, if it is too big to keep in memory and how you go about finding data.

Mattias Nilsson
Thanks for reply Mattias,well my scenario is this that I am making a prototype of e-commerce application.actualyy the database is on MSSQL server.the database contains info on customers, products, orders etcas I didnnt find a way to connect MSSQL with android, I used the XML to help me in this issue.I created separate XML of all the tables and uploaded them. so when in my application suppoer I am searching for a product, I parse the XML file and display the result on scree.but its very slow.that is why looking for alternate method or any solution to make parsing fast.thanks
kaibuki
So if you got the data from a MSSQL database, it shouldn't be too tricky to put in into another SQL database on the android device?Then again, I don't know how often you'd need to update your data compared to how often you read it. If you need to update it often, then you'll spend a lot of time on that.You do know there is an SQLite database available to you on the android device, right?
Mattias Nilsson