title: I just want direct children of an XML element, not all descendents
body: <p>I have an XML document that represents a directed graph. It contains a large number of direct children, all with ids, and a large number of nested children, all with the same tag names but no ids, just references. </p>
  
  <p>I would like to iterate over all of the direct children of the root node, but exclude the nested children. The files look something like this, but with hundreds of nodes and dozens of different tags:</p>
  
  <pre><code>&lt;graph&gt;
      &lt;foo id="f1"&gt;&lt;bar ref="b1" /&gt;&lt;baz ref="z1" /&gt;...&lt;/foo&gt;
      &lt;bar id="b1"&gt;&lt;foo ref="f1" /&gt;&lt;/bar&gt;
      &lt;baz id="z1"&gt;&lt;/baz&gt;
      ...
  &lt;/graph&gt;
  </code></pre>
  
  <p>I don't want to use <code>getElementsByTagName</code> because it returns all descendents.  I suspect I will need to use <code>.childnodes</code> and filter the results, but I want to make sure there isn't something I'm missing.</p>
  
  <p>Also, I don't have control of the input, it's from an outside source, and I'm using Python's xml.dom.minidom module, but I expect that to be an implementation detail.</p>