Trying to find a way to read an XML file and get all the nodes. Some of the XML files have 1 step depth, others 2, others more. Is there anyway to get all the nodes for all children without knowing their name? e.g. i wrote this piece of code but this works only for 2 steps depth
foreach ($xml->children() as $node) {
if ($node->children()->count()>0) {
foreach ($node->children() as $cnode){
echo $cnode->getName()."<br>";
}
}
echo $node->getName()."<br>";
}
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" >
<soap:Header/>
<soap:Body>
<multitrans xmlns="http://www.xxxx.xx/">
<authentication>
<username>xxxxxx</username>
<password>xxxxxx</password>
<clientid>xxxxxx</clientid>
</authentication>
<requests>
<trans_request>
<TransType tc="100"/>
<company tc="500"/>
<product tc="auto"/>
<inception>
<p_year>2017</p_year>
<p_month>5</p_month>
<p_day>15</p_day>
</inception>
<p_number>0</p_number>
<attributes>
<att val="0" name="SVCsynchronouscall" />
<att val="2" name="value1" />
<att val="2017-5-15" name="Date" />
<att val="0" name="value2" />
<att val="0" name="value3" />
<att val="0" name="value4" />
</attributes>
<warnings>
</warnings>
</trans_request>
</requests>
</multitrans>
</soap:Body>
</soap:Envelope>