Parse xml REST data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am working on an API which returns data in this format some lines of that
code are below but i cannot get into array or by using simpleXmlElement

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:response
xmlns:ns2="http://webservices.lastminute.com/services/xml/HotelsService/1.0";><ns2:getHotelAvailabilityResponse><ns2:HotelAvailabilityRs><ns2:Status>SUCCESS</ns2:Status><ns2:AvailableHotels><ns2:Hotel
resourceid="http://globaltrips-shopping-svcs:9001/lmnwebservices-1.0/remote-service/hotels/1068024-0-2-EXT:156996$v1v$?locale=en_GB&amp;currency=USD&amp;format=xml";><ns2:AccommCode>1068024-0-2-EXT:156996$v1v$</ns2:AccommCode><ns2:AccommAdditional>en_GB-LON-($n)-($n)-1-GB-($n)-1-4-($n)-5-5-1$v1v$</ns2:AccommAdditional><ns2:Source>MAGENTA</ns2:Source><ns2:Unbranded>false</ns2:Unbranded><ns2:Supplier>EXT:156996</ns2:Supplier><ns2:Details><ns2:AccommName>Pestana
Chelsea Bridge Hotel &amp; Spa</ns2:AccommName><ns2:Geocode
longitude="-0.14902" latitude="51.48205"/><ns2:Images><ns2:Image
id="0"><ns2:Description>Exterior
view</ns2:Description><ns2:Instances><ns2:Instance height="180"
width="250" type="LUXURY"
url="http://cdn.lastminute.com/netimages/pee/images/1068024_1068024/271703/250X180.jpeg"/><ns2:Instance
height="120" width="270" type="LARGE"
url="http://cdn.lastminute.com/netimages/pee/images/1068024_1068024/271703/270X120.jpeg"/><ns2:Instance
height="288" width="400" type="EXTRA_LARGE"
url="http://cdn.lastminute.com/netimages/pee/images/1068024_1068024/271703/400X288.jpeg"/><ns2:Instance
height="75" width="100" type="THUMBNAIL"
url="http://cdn.lastminute.com/netimages/pee/images/1068024_1068024/271703/100X75.jpeg"/><ns2:Instance
height="64" width="136" type="SMALL"
url="http://cdn.lastminute.com/netimages/pee/images/1068024_1068024/271703/136X64.jpeg"/></ns2:Instances></ns2:Image></ns2:Images><ns2:TextDescriptors><ns2:TextDescriptor
type="SHORT_DESC"><ns2:Text>**FOR 48 HOURS STAY BEFORE 30 APRIL AND
SAVE 20%**The brand new Pestana Chelsea Bridge Hotel &amp; Spa offers
world class service and facilities for leisure and business travelers
alike. The hotel has 216 well appointed, spacious rooms, spa and
lifestyle centre, a restaurant serving international cuisine, bar and
coffee shop and extensive secure underground
parking.</ns2:Text></ns2:TextDescriptor><ns2:TextDescriptor
type="HOTEL_MARKETING_NAME"><ns2:Text>Pestana Chelsea Bridge Hotel
&amp; Spa - 4* -
London</ns2:Text></ns2:TextDescriptor></ns2:TextDescriptors><ns2:StarRating>4</ns2:StarRating><ns2:BiasedRating>1</ns2:BiasedRating></ns2:Details><ns2:Availability><ns2:Rooms><ns2:Room><ns2:AvailabilityType>AVAILABLE</ns2:AvailabilityType><ns2:RoomDescription>Standard
Twin. Room Only.</ns2:RoomDescription><ns2:RateType>COMMISSIONABLE</ns2:RateType><ns2:Currency>USD</ns2:Currency><ns2:SellPriceByDate><ns2:SellPrice
price="189.39393" date="2011-05-01T00:00:00Z"/><ns2:SellPrice
price="189.39393" date="2011-05-02T00:00:00Z"/><ns2:SellPrice
price="248.12073"
date="2011-05-03T00:00:00Z"/></ns2:SellPriceByDate><ns2:TotalSellPrice>626.90859</ns2:TotalSellPrice><ns2:RateCode>4-4_2-3-2-1155949-0.0-0-1-2-0-20.0-1-432686-2-($n)$v1v$</ns2:RateCode><ns2:RateAdditional>0.0-0.0-0.0-0.0-0.0-0.0-($n)-($n)-($n)-($n)-0-GBP-GBP-SAP:156996-GBP-($n)-($e)$v1v$</ns2:RateAdditional><ns2:RackRate>0.0</ns2:RackRate><ns2:BoardType>RO</ns2:BoardType><ns2:RoomType>139920</ns2:RoomType><ns2:RoomParty><ns2:NumAdults>1</ns2:NumAdults></ns2:RoomParty><ns2:NumAvailable>3</ns2:NumAvailable><ns2:Promotions><ns2:Promotion
id="432686"><ns2:Description>Promotional discount - 10%
off</ns2:Description><ns2:EarliestBookingDate>2011-04-07T00:00:00Z</ns2:EarliestBookingDate><ns2:LatestBookingDate>2011-04-08T23:59:59.999Z</ns2:LatestBookingDate><ns2:EarliestCheckinDate>2011-05-01T00:00:00Z</ns2:EarliestCheckinDate><ns2:LatestCheckinDate>2011-05-04T23:59:59.999Z</ns2:LatestCheckinDate><ns2:PromotionItems><ns2:PromotionItem><ns2:FromDate>2011-05-01T00:00:00Z</ns2:FromDate><ns2:ToDate>2011-05-04T00:00:00Z</ns2:ToDate><ns2:PriceDelta>-69.65651103796289</ns2:PriceDelta></ns2:PromotionItem></ns2:PromotionItems></ns2:Promotion></ns2:Promotions><ns2:CheckinDate>2011-05-01T00:00:00Z</ns2:CheckinDate><ns2:CheckoutDate>2011-05-04T00:00:00Z</ns2:CheckoutDate></ns2:Room><ns2:Room><ns2:AvailabilityType>AVAILABLE</ns2:AvailabilityType><ns2:RoomDescription>Executive
Club King. Buffet
Breakfast.</ns2:RoomDescription><ns2:RateType>COMMISSIONABLE</ns2:RateType><ns2:Currency>USD</ns2:Currency><ns2:SellPriceByDate><ns2:SellPrice
price="306.86" date="2011-05-01T00:00:00Z"/><ns2:SellPrice
price="306.86" date="2011-05-02T00:00:00Z"/><ns2:SellPrice
price="365.57" date="2011-05-03T00:00:00Z"/></ns2:SellPriceByDate><ns2:TotalSellPrice>979.29</ns2:TotalSellPrice><ns2:RateCode>4-4_2-3-2-1155942-0.0-0-1-2-0-20.0-1-432685-2-($n)$v1v$</ns2:RateCode><


Can anyone please send code or tell how to parse this xml data so i can loop
through all records in xml data SimpleXmlElement returns blank

Regards
Farhan


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux