title: How to get values of all elements from XML string in Java?
body: <p>I have the a string in XML format. I want to read it and get the values of the elements.</p>
  
  <p>I have tried Java <a href="http://rocksolutions.wordpress.com/2010/08/10/jaxb-unmarshalling-strings-xmls/" rel="nofollow noreferrer">JAXBContext unmarshell</a>, but this needs creation of class which is not necessary for me.</p>
  
  <p>String:</p>
  
  <pre><code>&lt;customer&gt;
      &lt;age&gt;35&lt;/age&gt;
      &lt;name&gt;aaa&lt;/name&gt;
  &lt;/customer&gt;
  </code></pre>
  
  <p>I want to get the values of <strong>age</strong> and <strong>name</strong>.</p>