title: XML / C# Loop through nodes of the same name
body: <p>I have this XML file with keys and values, and I currently loop through the XML doc, and I read all the data.</p>
  
  <p>However, I have certain 'keys' or 'Nodes' that have the same keyname, but different (or same) values.
  I need to loop through these same nodes within the same parent node.</p>
  
  <pre><code>&lt;tile&gt;
     &lt;x&gt;0&lt;/x&gt;
     &lt;y&gt;1&lt;/y&gt;
     &lt;name&gt;Grass&lt;/name&gt;
     &lt;entity&gt;Tree&lt;/entity&gt;
     &lt;entity&gt;Building&lt;/entity&gt;
     &lt;entity&gt;Something&lt;/entity&gt;
  &lt;/tile&gt;
  &lt;tile&gt;
     &lt;x&gt;1&lt;/x&gt;
     &lt;y&gt;2&lt;/y&gt;
     &lt;name&gt;Dirt&lt;/name&gt;
     &lt;entity&gt;Tree&lt;/entity&gt;
     &lt;entity&gt;Building&lt;/entity&gt;
  &lt;/tile&gt; 
  </code></pre>
  
  <p>I need to get X, Y and the Name, and an array/list of the entity.
  This I need for every Tile in the XML.</p>
  
  <p>So I need to loop through all of the  and get the contents, including a list with the </p>
  
  <p>Current code:</p>
  
  <pre><code>        XmlElement element = doc.DocumentElement;
          XmlNodeList nList = element.SelectNodes("/map/tile");
          foreach(XmlNode node in nList){
              int x = int.Parse(node["x"].InnerText);
              int y = int.Parse(node["y"].InnerText);
              String materialName = node["name"].InnerText;
              for(node["entity"] in allEntityNodesWithinThisTile){ }
          }
  </code></pre>
  
  <p>Thanks</p>