title: Ruby- get a xml node value
body: <p>can someone help me in extracting the node value for the element "Name". </p>
  
  <p><strong>Type 1:</strong> I am able to extract the "name" value for the below xml by using the below code</p>
  
  <pre><code>&lt;Element&gt;
     &lt;Details&gt;
        &lt;ID&gt;20367&lt;/ID&gt;      
        &lt;Name&gt;Ram&lt;/Name&gt;
        &lt;Name&gt;Sam&lt;/Name&gt;
     &lt;/Details&gt;
  &lt;/Element&gt;
  
  
  doc = Nokogiri::XML(response.body)    
  values = doc.xpath('//Name').map{ |node| node.text}.join ','
  puts values
  </code></pre>
  
  <p><em>Output:</em> Ram,Sam</p>
  
  <p><strong>Type 2:</strong> Now, I am need to get the same formatted output for the below xml, How can I get it</p>
  
  <pre><code>&lt;Response xmlns="http://abc.def" xmlns:i="http://www.org"&gt;
     &lt;Name&gt;Ram&lt;/Name&gt;
     &lt;Name&gt;Sam&lt;/Name&gt;
  &lt;/Response&gt;
  </code></pre>
  
  <p>When I use the same code for this, I am not getting any output or error.</p>
  
  <p>Depends on the user's input, I get either the type 1 xml or type 2 xml as ouput. For the both the case I need to extract the "name" element value.
  If it is more than one element with the same name then comma separate the values.</p>