title: Getting all root elements that contain child element with certain string in xml
body: <p>Hi I am trying to return only a certain element from xml.. it is easier to explain like this:</p>
  
  <pre><code>&lt;HotelList activePropertyCount="129" size="20"&gt;
  &lt;HotelSummary ubsScore="820" order="0"&gt;
  &lt;hotelId&gt;121196&lt;/hotelId&gt;
  &lt;name&gt;ME Cancun - Complete ME All Inclusive&lt;/name&gt;
  &lt;address1&gt;Boulevard Kukulkan Km 12&lt;/address1&gt;
  &lt;city&gt;Cancun&lt;/city&gt;
  &lt;postalCode&gt;77500&lt;/postalCode&gt;
  &lt;countryCode&gt;MX&lt;/countryCode&gt;
  &lt;/HotelSummary&gt;
  &lt;/HotelList&gt;
  </code></pre>
  
  <p>There are a bunch of these all with different hotelID. I need to get the <code>&lt;HotelSummary&gt;</code> that has the child element of <code>&lt;hotelID&gt;121196&lt;/hotelID&gt;</code>. I can not figure out how to do this. I am using php and this is all I have so far:</p>
  
  <pre><code>&lt;?
  $post_string = 'type=xml&amp;cid=55505&amp;minorRev=13&amp;apiKey=4sr8d8bsn75tpcuja6ypx5g3&amp;locale=en_US&amp;currencyCode=USD&amp;customerIpAddress=10.184.2.9&amp;customerUserAgent=Mozilla/5.0+(Windows+NT+6.1)+AppleWebKit/535.11+(KHTML,+like+Gecko)+Chrome/17.0.963.79+Safari/535.11&amp;customerSessionId=&amp;xml=&lt;HotelListRequest&gt;&lt;arrivalDate&gt;04/05/2012&lt;/arrivalDate&gt;&lt;departureDate&gt;04/07/2012&lt;/departureDate&gt;&lt;RoomGroup&gt;&lt;Room&gt;&lt;numberOfAdults&gt;2&lt;/numberOfAdults&gt;&lt;/Room&gt;&lt;Room&gt;&lt;numberOfAdults&gt;2&lt;/numberOfAdults&gt;&lt;numberOfChildren&gt;&lt;/numberOfChildren&gt;&lt;/Room&gt;&lt;/RoomGroup&gt;&lt;city&gt;Cancun&lt;/city&gt;&lt;countryCode&gt;MX&lt;/countryCode&gt;&lt;supplierCacheTolerance&gt;MED_ENHANCED&lt;/supplierCacheTolerance&gt;&lt;/HotelListRequest&gt; ';
  $path = "http://api.ean.com/ean-services/rs/hotel/v3/list"; //Relative path to the file with $_POST parsing
  $ch = curl_init($path); 
  $fp = fopen('room.xml','w');
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string); //Send the data to the file
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml')); 
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_FILE, $fp);
  $val = curl_exec($ch);
  curl_close($ch);//Close curl session
  fclose($fp); //Close file overwrite
  
  $data = simplexml_load_file('room.xml');
  
  $info=$data-&gt;HotelList-&gt;HotelSummary-&gt;hotelId="123658";
  $rating=$info-&gt;hotelRating;
  echo $rating;
  ?&gt;
  </code></pre>
  
  <p>Thank you in advance!!!</p>