- simplexml_load_string: documentation ( source)
<?php
$xml = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<InvokeServiceResponse xmlns="http://www.avanicimcon.com/XMLSchema">
<DXResponse TimeStamp="03/13/2014" Target="Test" Version="1.0">
<Success/>
<UserInfo>
<UserName>
ttdxlu
</UserName>
</UserInfo>
<ServiceDetails>
<Providers>
<Provider>
ActlLookup
</Provider>
</Providers>
<ServiceName>
RetrieveHotelLocations
</ServiceName>
</ServiceDetails>
<ResponseData>
<Providers xmlns="">
<Provider Name="ActlLookup">
<RetrieveHotelLocationsRS xmlns="http://www.avanicimcon.com/XSD">
<CodeCategories>
<CodeCategory ID="LCL" Name="LocationCodeList">
<Code ID="AU32" Value="Top End Northern Territory, Australia - Location" CountryID="AU" Type="Location"/>
<Code ID="AU7" Value="Top End, Australia - Location" CountryID="AU" Type="Location"/>
</CodeCategory>
</CodeCategories>
</RetrieveHotelLocationsRS>
</Provider>
</Providers>
</ResponseData>
</DXResponse>
</InvokeServiceResponse>
</s:Body>
</s:Envelope>';
$xml = simplexml_load_string( $xml);
foreach( $xml->xpath( './/InvokeServiceResponse') as $child) {
echo $child->attributes()['xmlns'] . "\n";
}