It is interesting to note that this function will stop on closing tags as well.  I have an XML document similar to the following:
<root>
  <columns>
    <column>columnX</column>
    <column>columnY</column>
  </columns>
  <table>
    <row>
      <columnX>38</columnX>
      <columnY>50</columnY>
    </row>
    <row>
      <columnX>82</columnY>
      <columnY>28</columnY>
    </row>
    ...
  </table>
</root>
I need to parse the <columns> object to know what attributes to check for from each <row> node.  Therefore I was doing the following:
<?php
while ($xml->read()) {
  if ($xml->name === 'column') {
   }
  elseif ($xml->name === 'row') {
    }
}
?>
This kind of worked in that I ended up with an array of all the data I wanted, but the array I constructed was twice as large as I expected and every other entry was empty.  Took me a while to debug, but finally figured out that checking <?php $xml->name === 'row' ?> matches both <row> and </row>, so the check should really be something more like:
<?php
if ($xml->name === 'row' && $xml->nodeType == XMLReader::ELEMENT) {
  }
?>
I would have liked to use the next() function instead, but as I needed to parse 2 different subtrees, I couldn't figure out how to find all the columns, reset the pointer, and then find all the rows.