1

I'm trying to write a dictionary application on Android, using a gzipped xml file (1,25 mb) containing the dictionary entries.

I'm not sure how to approach searching the xml file. There's XPath, but it loads the whole file into memory. So should I be looking into streaming (SAX, vdt-xml, ...) or rather try to create a SQL database from the XML file? Or something else?

blub
  • 8,757
  • 4
  • 27
  • 38
  • Take a look at [this question](http://stackoverflow.com/questions/996103/streaming-xpath-evaluation) about streaming XPath evaluation. – Ranhiru Jude Cooray Nov 28 '12 at 09:54
  • 1
    Even if you are able to stream read, You'll have to go through the entire file to reach a word at the end. SQLite database is a better and faster option in my opinion. – S.D. Nov 28 '12 at 10:03
  • 1
    Creating SQLite DB from the XML on first launch of the app looks reasonable. Compressed XML is easy to distribute with the app and SQLite DB is fast in use. – Andrey Voitenkov Nov 28 '12 at 10:11
  • Thanks for your answers! I'll go with the sqlite db approach! – blub Nov 30 '12 at 05:42

1 Answers1

0

I ended up creating a SQLite DB from the XML with a python script and then copying the db file into the system database path as described in this answer:

https://stackoverflow.com/a/620086/1822977

Worked like a charm!

Community
  • 1
  • 1
blub
  • 8,757
  • 4
  • 27
  • 38