XML Get Value of Node DOMXPath

From: Date: Mon, 15 Dec 2008 15:28:52 +0000
Subject: XML Get Value of Node DOMXPath
Groups: php.general 
Request: Send a blank email to php-general+get-284630@lists.php.net to get a copy of this message
Hello all, Need help to get the value of the node. We know how to get the value of the city , item and itemPrice nodes below. How do we get the value of NumberOfRooms? $hotelElements = $xpath->query( 'xxxx', $searchReponseElement ); foreach( $hotelElements as $hotelElement ) { $city = $xpath->query( 'City' , $hotelElement ); $item = $xpath->query( 'Item' , $hotelElement ); $itemPrice = $xpath->query( 'ItemPrice' , $hotelElement ); $confirmation = $xpath->query( 'Confirmation' , $hotelElement ); } Here is an example of the XML Response: <Hotel HasExtraInfo="true"> <City Code="AMS"><![CDATA[ Amsterdam ]]></City> <Item Code="JAN"><![CDATA[ JAN LUYKEN HTL AND RESIDENCE]]></Item> <LocationDetails> <Location Code="G1"><![CDATA[ Central ]]></Location> </LocationDetails> <StarRating>4</StarRating> <HotelRooms> <HotelRoom Code="SB" NumberOfRooms="1" /> <HotelRoom Code="TB" ExtraBed="true" NumberCots="1" NumberOfExtraBeds="2" NumberOfRooms="1 SharingBedding="true" /> </HotelRooms> Thanks -- View this message in context: http://www.nabble.com/XML-Get-Value-of-Node-DOMXPath-tp21015877p21015877.html Sent from the PHP - General mailing list archive at Nabble.com.

« previous php.general (#284630) next »