title: Python XML Minidom Get element by tag in child node
body: <p>I am curently working on a IRC Bot and want to retrieve the configuration from an XML file that look like this :</p>
  
  <pre><code>&lt;server&gt;
    &lt;host&gt; HOST1 &lt;/host&gt;
    &lt;port&gt; 6667 &lt;/port&gt;
    &lt;channel&gt;
      &lt;name&gt; CHANNAME1&lt;/name&gt;
    &lt;/channel&gt;
    &lt;channel&gt;
      &lt;name&gt; CHANNAME2 &lt;/name&gt;
    &lt;/channel&gt;
  &lt;/server&gt;
  &lt;server&gt;
    &lt;host&gt; HOST2 &lt;/host&gt;
    &lt;port&gt; 6667 &lt;/port&gt;
    &lt;channel&gt;
      &lt;name&gt; CHANNAME3 &lt;/name&gt;
    &lt;/channel&gt;
  &lt;/server&gt;
  </code></pre>
  
  <p>And my code look like this :</p>
  
  <pre><code>doc = minidom.parse(xml)
  node = doc.documentElement
  servers = doc.getElementsByTagName("server")
  
  for server in servers:
  
      channels = server.getElementsByTagName("channel")
      host = server.getElementsByTagName("host")[0].childNodes[0].data
      print host
  
      for channel in channels:
          NAME = channel.getElementsByTagName("name")[0].childNode[0].data
          print NAME
  </code></pre>
  
  <p>And the output is</p>
  
  <pre><code>HOST1
  CHANNAME1
  CHANNAME2
  CHANNAME3
  HOST2
  CHANNAME1
  CHANNAME2
  CHANNAME3
  </code></pre>
  
  <p>But all I need is </p>
  
  <pre><code>HOST1
  CHANNAME1
  CHANNAME2
  HOST2
  CHANNAME3
  </code></pre>
  
  <p>Is there a way to get all the elements with the tag name "channel" within my node server instead of the whole xml file ?</p>