Given the following XML:
$xmlstr = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DataService xmlns="http://www.example.com">
<Response>
<XMLRootNode xmlns="http://www.example.com">
<ResponseHeader>
<Version>2.0</Version>
<RecordCount>2</RecordCount>
</ResponseHeader>
<OnlineInformation BoothID="12345">
<EventID>4</EventID>
...
How can I access the contents of EventID
using PHP's SimpleXML extension? I've had success with a simple example form here, but I cannot seem to traverse the more complex tree structure above. My basic code is below. I want $output
to contain the value 4.
$data = new SimpleXMLElement($xmlstr);
$output = $data->...
Thanks.