Can we change this xml response into array. Please help me.
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:OTA_HotelAvailRQResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://components.hotelsv3">
<OTA_HotelAvailRQReturn xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?>
<OTA_HotelAvailRS Version="1.0">
<Success Id="141334"/>
<Properties>
<Property HotelCityCode="ELS" HotelCode="26824" HotelName="Premier Hotel Regent - Demo">
<RelativePosition Direction="" Distance="0" DistanceUnitName=""/>
<EssentialInfo>
</EssentialInfo>
<RoomStays>
<RoomStay>
<RatePlans>
<RatePlan RatePlanCode="71316"/>
</RatePlans>
<RoomRates>
<RoomRate>
<Rates>
<Rate EffectiveDate="2011-10-14" ExpireDate="2011-10-15">
<Base Amount="114.00" CurrencyCode="EUR"/>
<RateDescription Adults="1" Availability="A" Children="0" RoomNum="1">
Standard
</RateDescription>
</Rate>
</Rates>
</RoomRate>
</RoomRates>
<Meals Description="Breakfast Buffet" MealType="Breakfast"/>
</RoomStay>
</RoomStays>
<Promotions/>
<AdditionalInfo>
<HotelStarDetail rating="3"/>
<HotelImages>
<HotelImage Type="" URL="http://image1.urlforimages.com/1204258/Premier-Hotel-Regent_guest.jpg"/>
</HotelImages>
<HotelDescription>
<LongDescription> guest rooms 175 guestrooms</LongDescription>
</HotelDescription>
</AdditionalInfo>
</Property>
<Property HotelCityCode="ELS" HotelCode="26823" HotelName="Mpongo Private Game Reserve - Demo">
<RelativePosition Direction="" Distance="0" DistanceUnitName=""/>
<EssentialInfo>
</EssentialInfo>
<RoomStays>
<RoomStay>
<RatePlans>
<RatePlan RatePlanCode="71314"/>
</RatePlans>
<RoomRates>
<RoomRate>
<Rates>
<Rate EffectiveDate="2011-10-14" ExpireDate="2011-10-15">
<Base Amount="117.00" CurrencyCode="EUR"/>
开发者_开发知识库 <RateDescription Adults="1" Availability="A" Children="0" RoomNum="1">
Standard
</RateDescription>
</Rate>
</Rates>
</RoomRate>
</RoomRates>
<Meals Description="Half board" MealType="HalfBoard"/>
</RoomStay>
<RoomStay>
<RatePlans>
<RatePlan RatePlanCode="71315"/>
</RatePlans>
<RoomRates>
<RoomRate>
<Rates>
<Rate EffectiveDate="2011-10-14" ExpireDate="2011-10-15">
<Base Amount="174.00" CurrencyCode="EUR"/>
<RateDescription Adults="1" Availability="A" Children="0" RoomNum="1">
River Lodge
</RateDescription>
</Rate>
</Rates>
</RoomRate>
</RoomRates>
<Meals Description="Half board" MealType="HalfBoard"/>
</RoomStay>
</RoomStays>
<Promotions/>
<AdditionalInfo>
<HotelStarDetail rating="4"/>
<HotelImages>
<HotelImage Type="" URL="http://image1.urlforimages.com/1204253/Mpongo-Private_guest.jpg"/>
</HotelImages>
<HotelDescription>
<LongDescription> Accommodation: 18 guestrooms</LongDescription>
</HotelDescription>
</AdditionalInfo>
</Property>
</Properties>
</OTA_HotelAvailRS></OTA_HotelAvailRQReturn>
</ns1:OTA_HotelAvailRQResponse>
</soapenv:Body>
Have a look at http://www.php.net/manual/en/class.domdocument.php
<?php
$doc = new DOMDocument();
$doc->loadXML($xml);
$nodes = $doc->getElementsByTagName('*');
$values = array();
foreach($nodes as $node) {
$values[] = $node->nodeValue;
}
?>
精彩评论