title: PHP DOMDocument getting element data with particular attribute name
body: <p>The XML</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;items version="1.5"&gt;
      &lt;item name="device"&gt;iphone&lt;/item&gt;
      &lt;item name="affinity"&gt;testing&lt;/item&gt;
  &lt;/items&gt;
  </code></pre>
  
  <p>I need to get the value 'iphone' and value 'testing' from device and affinity, how do I select them?</p>
  
  <p>I've tried:</p>
  
  <pre><code>$xml        = new DOMDocument();
  $xml-&gt;loadXML($request);
  $itemList   = $xml-&gt;getElementsByTagName('item');
  foreach($itemList as $install)
  {
      echo $install-&gt;getAttribute('device')-&gt;item(0)-&gt;nodeValue;          
  }
  </code></pre>
  
  <p>But that doesn't seem to work.</p>
  
  <p>Thank you!</p>