ANDROID: Parsing XML
<p>I'm not a developer, I just dabble in programming. One area I never understand is XML parsing. Sadly, for my latest "project" I need to do this very thing for an android app. Its a prototype that I am doing for work.</p>

<p>I have this XML (a mock-up file):</p>

<pre><code>&lt;feed version="201010011221" &gt; 
  &lt;period from="2010-10-01T10:08:34Z" to="2010-10-01T10:08:34Z"&gt; 
    &lt;lines&gt; 
      &lt;line id="SKI" name="Ski" shortname="ski" status="1 calls queued"&gt; 
        &lt;calls&gt; 
          &lt;call id="6584" created="2010-10-01T11:22:42Z"&gt;
            &lt;booking&gt;1275243&lt;/booking&gt;
          &lt;/call&gt; 
        &lt;/calls&gt; 
      &lt;/line&gt; 
      &lt;line id="CRU" name="Cruise" shortname="cruise" status="0 calls queued"&gt; 
        &lt;calls /&gt; 
      &lt;/line&gt; 
      &lt;line id="VIL" name="Villas" shortname="villas" status="2 calls queued"&gt; 
        &lt;calls&gt; 
          &lt;call id="25878" created="2010-10-01T10:22:42Z"&gt;
            &lt;booking&gt;1077244&lt;/booking&gt;
          &lt;/call&gt; 
          &lt;call id="25878" created="2010-10-01T10:22:42Z"&gt;
            &lt;booking&gt;1077244&lt;/booking&gt;
          &lt;/call&gt; 
        &lt;/calls&gt; 
      &lt;/line&gt;
    &lt;/lines&gt;
  &lt;/period&gt; 
&lt;/feed&gt;
</code></pre>

<p>I have some code that gets me a NodeList of each :</p>

<pre><code>inputStream = OpenHttpConnection(URL);
Document document = null;
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder;
documentBuilder = documentBuilderFactory.newDocumentBuilder();
document = documentBuilder.parse(inputStream);
document.getDocumentElement().normalize();
NodeList lineNodes = document.getElementsByTagName("line");
</code></pre>

<p>I'm not sure what to do next. My code seems quite long for this. I've googled for better methods, but some cleaner code I found, I couldn't get to work.</p>

<p>Are there any good Android XML tutorials out there? Or can someone assist me with this code?</p>

<p>I need to get each  into a HashMap where String is the ID.</p>

<p>Line is class of all info shown.</p>

<p>Thanks
Neil</p>
