title: Extracting elements from an HTTP XML response--HTTP Client & Java
body: <p>So I've gotten help from here already so I figured why not try it out again!? Any suggestions would be greatly appreciated.</p>
  
  <p>I'm using HTTP client and making a POST request; the response is an XML body that looks like the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;CartLink 
      xmlns="http://api.gsicommerce.com/schema/ews/1.0"&gt;
      &lt;Name&gt;vSisFfYlAPwAAAE_CPBZ3qYh&lt;/Name&gt;
      &lt;Uri&gt;carts/vSisFfYlAPwAAAE_CPBZ3qYh&lt;/Uri&gt;
  &lt;/CartLink&gt;
  </code></pre>
  
  <p>Now... </p>
  
  <p>I have an HttpEntity which is </p>
  
  <pre><code>[HttpResponse].getEntity(). 
  </code></pre>
  
  <p>Then I get a String representation of the response (which is XML in this case) by saying</p>
  
  <pre><code>String content = EntityUtils.toString(HttpEntity)
  </code></pre>
  
  <p>I tried following some of the suggestions on this post: <a href="https://stackoverflow.com/questions/7607327/how-to-create-a-xml-object-from-string-in-java">How to create a XML object from String in Java?</a> but it did not seem to work for me. When I built up the document it still appeared to be null. </p>
  
  <p>MY END GOAL here is just to get the NAME field.. i.e. the "vSisFfYlAPwAAAE_CPBZ3qYh" part. So do I want to build up a document and then extract it...? Or is there a simpler way? I've been trying different things and I can't seem to get it to work.</p>
  
  <p>Thanks for all of the help guys, it is most appreciated!!</p>