PHP - 使用NameSpaces解析复杂的XML

I'm guessing the NameSpaces are causing simplexml_load_string to not work, but I'm definitely not sure.

log.xml

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sns="http://soap.com/pbx">
   <env:Body>
      <sns:CDR>
         <PrimaryCallID>02v7b7c16v@12.123.123.12</PrimaryCallID>
         <CallID>d352f920@pbx</CallID>
         <From>"SMITH JOHN    " &lt;sip:11234567890@sub.domain.com:5060;user=phone&gt;</From>
         <To>&lt;sip:3216549870@111.111.111.111:5060;user=phone&gt;</To>
         <Direction>O</Direction>
         <Type>attendant</Type>
         <RemoteParty />
         <LocalParty />
         <TrunkName />

... more xml...

      </sns:CDR>
   </env:Body>
</env:Envelope>

parse.php

<?php 
$string = "log.xml";
$xml = simplexml_load_string($string);
print_r($xml);
?>

I'm getting nothing back from the print_r What am I missing?

simplexml_load_string takes a string as an argument not a filename.
you're trying to load the string "log.xml" as a XML and that doesn't work
you can use this intead:

$filename = "log.xml";
$xml = simplexml_load_string(file_get_contents($filename));
print_r($xml);