title: XML iteration issues (Android/Java)
body: <p>To set the scene, I'm currently working on an XML adapter for Android that will read in the XML files I've been given and parse them into a database. I thought I had this down until they sprung on me that the nodes in the XML file could change from file to file, and so I need to build in a mechanism to cope with missing variables.</p>
  
  <p>The most obvious solution to this was a <code>switch()</code> statement, but that won't work with strings, so I started building an <code>if-then-else</code> structure. The idea was that it would check the name of the node and work out what to do with it based on that. Simple, no?</p>
  
  <p>The problem is, I can't seem to pull the name of the nodes I need from the XML file no matter what I do. The structure of the XML file is below:</p>
  
  <pre><code>&lt;Vehicle&gt;
      &lt;Detail&gt;
          &lt;VIN&gt;BBB2791276393&lt;/VIN&gt;
          &lt;RegNo&gt;KN05EAP&lt;/RegNo&gt;
          &lt;Doors&gt;5&lt;/Doors&gt;
      &lt;/Detail&gt;
  &lt;/Vehicle&gt;
  </code></pre>
  
  <p>What I need to be able to compare against is tag names like "VIN" or "RegNo", but I can't figure out a way to pull them out. ETA: As I didn't make this clear, the child nodes of Detail change between XML files, and I have to deal with them as they come...</p>
  
  <p>I'm using a DOM parser, and pulling out a <code>NodeList</code> based on <code>&lt;Detail&gt;</code>. <code>NodeList.item(0)</code> gives me the <code>&lt;Detail&gt;</code> node, but if I then try and break that down (with <code>getChildNodes()</code> for example), I can't get the tag names for <code>&lt;VIN&gt;</code> or <code>&lt;RegNo&gt;</code>. In fact, I can't seem to get any kind of reference for them that I could use to determine what node it is based on the original name.</p>
  
  <p>Anyone got any ideas?</p>