title: Using XPath to Check if Soap Envelope Contains Child Node
body: <p>I'm trying to determine if a soap envelope body contains a particular node. </p>
  
  <p>An example of the envelope I'm working with:</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;soapenv:Body&gt;
          &lt;Response&gt;
              &lt;Result&gt;Failure&lt;/Result&gt;
              &lt;Error id="40020" value=""&gt;An Unkown Error Occured&lt;/Error&gt;
          &lt;Response&gt;
      &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>I want to check if the  contains the node "Response" so I can perform conditional operations on it as a result. I'm relatively new to XPath, so I'm not sure what the full expression should be.</p>
  
  <p>The XPath expression I currently have is </p>
  
  <pre><code>[name(//soapenv:Body/*[1]) = 'Response']
  </code></pre>
  
  <p>I know name(//soapenv:Body/*[1]) will return the value of "Response", I just don't know how to compare that result to another value and return true/false.</p>
  
  <p>Maybe something like this as an alternative expression?</p>
  
  <pre><code>//soapenv:Body/*[contains(Name, "Response")]
  </code></pre>