XML文件:
<code><human> <person> Jack </person> <person> Tom </person> <person> Jerry </person> </human> **代码:** $reader = new XMLReader(); $reader->open("example.xml"); while ($reader->read()) { if($reader->nodeType==XMLREADER::ELEMENT) { if ($reader->localName == "Human") { while ($reader->read()) { if ($reader->nodeType == XMLREADER::ELEMENT) { if ($reader->localName == "person") { $reader->read(); echo $reader->value; } ... while语句跳出需要执行break;但这里不知道从哪儿跳出,可以保证全部读出Tom,Jack,Jerry? </code>
XML文件:
<code><human> <person> Jack </person> <person> Tom </person> <person> Jerry </person> </human> **代码:** $reader = new XMLReader(); $reader->open("example.xml"); while ($reader->read()) { if($reader->nodeType==XMLREADER::ELEMENT) { if ($reader->localName == "Human") { while ($reader->read()) { if ($reader->nodeType == XMLREADER::ELEMENT) { if ($reader->localName == "person") { $reader->read(); echo $reader->value; } ... while语句跳出需要执行break;但这里不知道从哪儿跳出,可以保证全部读出Tom,Jack,Jerry? </code>