title: Nokogiri XML Searching
body: <p>I've tried reading the Nokogiri docs, etc, but I've came to a road block.</p>
  
  <p>I get an XML output similar to</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;soap:Body&gt;
      &lt;ns1:getPoliciesResponse xmlns:ns1="http://policy.api.control.r1soft.com/"&gt;
        &lt;return&gt;
          &lt;CDPId&gt;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx&lt;/CDPId&gt;
          &lt;description/&gt;
          &lt;diskSafeID&gt;bcb68765-a719-4291-912d-2e6af485ea24&lt;/diskSafeID&gt;
          &lt;enabled&gt;true&lt;/enabled&gt;
          &lt;id&gt;cdb65427-d6f4-4a89-9f77-8763e22dc74b&lt;/id&gt;
          &lt;lastReplicationRunTime&gt;2013-06-12T13:29:40.105-05:00&lt;/lastReplicationRunTime&gt;
          &lt;name&gt;pstueck-passenger ondemand&lt;/name&gt;
          &lt;replicationScheduleFrequencyType&gt;ON_DEMAND&lt;/replicationScheduleFrequencyType&gt;
          &lt;state&gt;OK&lt;/state&gt;
        &lt;/return&gt;
        &lt;return&gt;
          &lt;CDPId&gt;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx&lt;/CDPId&gt;
          &lt;description/&gt;
          &lt;diskSafeID&gt;e8e13555-f577-40d2-99c8-fa8a019d3b55&lt;/diskSafeID&gt;
          &lt;enabled&gt;true&lt;/enabled&gt;
          &lt;id&gt;7f55f8d6-92a9-4b14-bff4-631559d92259&lt;/id&gt;
          &lt;lastReplicationRunTime&gt;2013-06-16T22:00:04.918-05:00&lt;/lastReplicationRunTime&gt;
          &lt;name&gt;pstueck-mysql daily&lt;/name&gt;
          &lt;nextReplicationRunTime&gt;2013-06-17T22:00:00-05:00&lt;/nextReplicationRunTime&gt;
          &lt;replicationScheduleFrequencyType&gt;DAILY&lt;/replicationScheduleFrequencyType&gt;
          &lt;state&gt;ALERT&lt;/state&gt;
          &lt;warnings&gt;Policy last completed with alerts&lt;/warnings&gt;
        &lt;/return&gt;
      &lt;/ns1:getPoliciesResponse&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>But I have a large # of 'return' sections that get displayed back.  I'm trying to use the .search at the end of string.  I'm only wanting it to return the entire 'return' section for a given 'name'.  Anyone have any tips?</p>
  
  <p>Current Code:</p>
  
  <pre><code>client = Savon::Client.new do
    http.auth.basic "#{opts['api_username']}", "#{opts['api_password']}"
    wsdl.document = "#{opts['api_url']}/Policy?wsdl"
  end
  
  getPolicyInformation = client.request :getPolicies
  getPolicyInformation = Nokogiri::XML(getPolicyInformation.to_xml)
  print getPolicyInformation
  </code></pre>
  
  <p>I'm wanting to return everything in the <code>&lt;return&gt;</code> section if I search for a specified <code>&lt;name&gt;</code>.  Example:  I only want to see the information relating to <code>&lt;name&gt;pstueck-passenger ondemand&lt;/name&gt;</code>, but the entire <code>&lt;return&gt;</code> section that contains that.</p>