title: Parsing a namespace in Groovy when the namespace is not specified in the root element?
body: <p>I'm writing a Groovy script to parse a SOAP response from a web service, and the XML specifies a namespace in the middle of the document:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
     &lt;soap:Body&gt;
        &lt;AuthenticateResponse xmlns="KaseyaWS"&gt;
           &lt;AuthenticateResult&gt;
              &lt;SessionID&gt;xxxxxxxxxx&lt;/SessionID&gt;
              &lt;Method&gt;Authenticate&lt;/Method&gt;
              &lt;TransactionID&gt;4228&lt;/TransactionID&gt;
              &lt;ErrorMessage/&gt;
              &lt;ErrorLocation/&gt;
           &lt;/AuthenticateResult&gt;
        &lt;/AuthenticateResponse&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>The namespace doesn't specify a name, it just applies to everything within the <code>&lt;AuthenticateResponse xmlns="KaseyaWS"&gt;</code> node, but I'd still like to be able to parse it.</p>
  
  <p>The <a href="http://groovy.codehaus.org/api/groovy/util/slurpersupport/GPathResult.html" rel="nofollow">GPathResult</a> returned from the <code>parseText()</code> method allows you to call <code>declareNameSpace(Map m)</code> to add a namespace to the document like so:</p>
  
  <pre><code>def slurper = XmlSlurper().parseText(someXMLText).declareNamespace(soap:'http://schemas.xmlsoap.org/soap/envelope/')
  </code></pre>
  
  <p>But I don't rightly understand how to call <code>declareNamespace()</code> on the <a href="http://groovy.codehaus.org/api/groovy/util/slurpersupport/GPathResult.html" rel="nofollow">GPathResult</a> to specify the anonymous namespace (<code>xmlns="KaseyaWS"</code>).</p>