Re: Extract code from XML

From: Date: Fri, 30 Jan 2009 09:40:59 +0000
Subject: Re: Extract code from XML
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-287401@lists.php.net to get a copy of this message
check this : http://nl3.php.net/manual/en/book.simplexml.php best regards Robert Angelo Zanetti :
------------------------------------------------------------------------ Hi all, I have the following snippet of XML: Code: <HotelDetails>
                          <Hotel HasExtraInfo="true" HasMap="true" HasPictures="true">
                                                            <Item Code="AME"><![CDATA[ AMERICAN ]]></Item>
I need to get the Code for the item, IE get the value "AME" from the XML. I am using PHP5 and the following code which I can extract the value of the Item: "AMERICAN". PHP Code: $hotelElements = $xpath->query( 'HotelDetails/Hotel', $searchHotelPriceReponseElement );
    foreach( $hotelElements as $hotelElement ) {
        $item = $xpath->query( 'Item' , $hotelElement );
I know you can use an @ sign but I am not 100% sure. Thanks in advance. Kind regards, Angelo Zanetti Application Developer ------------------------------------------------------------------------ **Telephone:** +27 (021) 552 9799
**Mobile****:**       +27 (0) 72 441 3355
**Fax:**            +27 (0) 86 681 5885
* **Web:*** http://www.elemental.co.za **E-Mail:** angelo@elemental.co.za <mailto:angelo@elemental.co.za>


« previous php.general (#287401) next »