目前有这样一段XML解析PHP代码:<?php
$xml = simplexml_load_file("test.xml");
echo $xml->getName() . "<br />";
foreach($xml->children() as $child) {
    echo $child->getName() . ": " . $child . "<br />";
}
?>
有下面的XML:<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>
这样php能正确输出结果:note
to: George
from: John
heading: Reminder
body: Don't forget the meeting!但是若XML变成:<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>George</to>
<from>
<name>
<Chinesename>Zhang</Chinesename>
<Englishname>Jonn</Englishname>
</name>
<age>21</age>
</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>
就解析不出来了:
note
to: George
from:
heading: Reminder
body: Don't forget the meeting!
就是说只能解析第一级的 不能解析更下面的元素现在需要能够解析出所有的元素