title: Not finding elements using getElementsByTagName() using DOMDocument
body: <p>I'm trying to loop through multiple <code>&lt;LineItemInfo&gt;</code> products contained within a <code>&lt;LineItems&gt;</code> within XML I'm parsing to pull product Ids out and send emails and do other actions for each product.</p>
  
  <p>The problem is that it's not returning anything.  I've verified that the XML data is valid and it does contain the necessary components.</p>
  
  <pre><code>$itemListObject = $orderXML-&gt;getElementsByTagName('LineItemInfo');
  var_dump($itemListObject-&gt;length);
  var_dump($itemListObject);
  </code></pre>
  
  <p>The output of the <code>var_dump</code> is:</p>
  
  <pre><code>int(0)
  object(DOMNodeList)#22 (0) {
  }
  </code></pre>
  
  <p>This is my first time messing with this and it's taken me a couple of hours but I can't figure it out.  Any advice would be awesome.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>My XML looks like this... except with a lot more tags than just ProductId</p>
  
  <pre><code>&lt;LineItems&gt;
       &lt;LineItemInfo&gt;
           &lt;ProductId href='[URL_TO_PRODUCT_XML]'&gt;149593&lt;/ProductId&gt;
       &lt;/LineItemInfo&gt;
       &lt;LineItemInfo&gt;
           &lt;ProductId href='[URL_TO_PRODUCT_XML]'&gt;149593&lt;/ProductId&gt;
       &lt;/LineItemInfo&gt;
  &lt;/LineItems&gt;
  </code></pre>
  
  <p>Executing the following code does NOT get me the ProductId</p>
  
  <pre><code>$itemListObject = $orderXML-&gt;getElementsByTagName('LineItemInfo');
  foreach ($itemListObject as $element) { 
          $product = $element-&gt;getElementsByTagName('ProductId');
          $productId = $product-&gt;item(0)-&gt;nodeValue;
          echo $productId.'-';
  }
  </code></pre>
  
  <p><strong>EDIT #2</strong></p>
  
  <p>As a side note, calling</p>
  
  <pre><code>$element-&gt;item(0)-&gt;nodeValue
  </code></pre>
  
  <p>on $element instead of $product caused my script's execution to discontinue and not throwing any errors that were logged by the server.  It's a pain to debug when you have to run a credit card to find out whether it's functioning or not.</p>