title: XMLReader get a node name
body: <p>I'm using XMLReader, how can I have in a while every node name?</p>
  
  <pre><code>$reader = new XMLReader;
  $reader-&gt;xml($MyXml);
  while ($reader-&gt;read() !== FALSE) {
    if ($reader-&gt;name === 'Product' &amp;&amp; $reader-&gt;nodeType === XMLReader::ELEMENT) {    
      if ($reader-&gt;readString() != '') {
        echo $reader-&gt;getAttribute(name).'  --&gt;  '.$reader-&gt;readString();                 
      }
    }
  }
  </code></pre>
  
  <p>I need to have every node name this way don't work <code>echo $reader-&gt;getAttribute(name)</code></p>