title: Android: Is it more efficient to use a text file or an XML file to store static data
body: <p>I have some reference data in a text file (~5MB) that I want to use with might android application.</p>
  
  <p>The file is of the format:</p>
  
  <pre><code>1|a|This is line 1a
  1|b|This is line 1b
  2|a|This is line 2a
  2|b|This is line 2b
  2|c|This is line 2c
  </code></pre>
  
  <p>What I want to know is the most efficient way (less memory, fast, size etc.) to use this file within my application.</p>
  
  <p>a.) Should I save the file as a raw resource and open and read the whole file whenever I need a certain line.</p>
  
  <p>b.) Should I convert the file to XML and use XPath to query the file when ever I need to look up a value</p>
  
  <pre><code>&lt;!--sample XML --&gt;
  &lt;data&gt;
    &lt;line number="1"&gt;
       &lt;entry name="a"&gt;This is line 1 a&lt;/entry&gt;
    &lt;/line&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>c.) Should I just copy &amp; paste the whole file as a static string array in the application and use that.</p>
  
  <p>... any other suggestions are welcome.</p>
  
  <p><strong>[EDIT]</strong>
  I will also need to search this file and jump to arbitrary keywords e.g. "line 1a".</p>