title: W3C DOM API in Java, get child elements by name
body: <p>I just realized that the method <code>Element.getElementsByTagName("someTagName")</code> returns a nodelist of all elements in the document that have a given tagname. What if I just want to get all child elements by tag name?</p>
  
  <p>For example...    </p>
  
  <pre><code>&lt;person&gt;
    &lt;name&gt;Bob&lt;/name&gt;
    &lt;car&gt;
      &lt;name&gt;Toyota Corolla&lt;/name&gt;
    &lt;/car&gt;
  &lt;/person&gt;
  </code></pre>