title: Java XML XPath Full XML
body: <p>got a little problem. I have the following code:</p>
  
  <pre><code>DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = factory.newDocumentBuilder();
          Document doc = builder.parse("result1.xml");
          XPathFactory xPathfactory = XPathFactory.newInstance();
          XPath xpath = xPathfactory.newXPath();
          XPathExpression expr = xpath.compile("//element");
          String elements = (String) expr.evaluate(doc, XPathConstants.STRING);
  </code></pre>
  
  <p>What i get : </p>
  
  <pre><code>        jcruz0@exblog.jp
          Cheryl
          Blake
          195115
  </code></pre>
  
  <p>What i want:</p>
  
  <pre><code>&lt;person&gt; 
    &lt;email&gt;jcruz0@exblog.jp&lt;/email&gt;
    &lt;firstname&gt;Cheryl&lt;/firstname&gt;
    &lt;lastname&gt;Blake&lt;/lastname&gt;
    &lt;number&gt;195115&lt;/number&gt; 
  &lt;/person&gt;
  </code></pre>
  
  <p>So as you can see i want the full XML tree. Not just the NodeValue.
  Maybe somebody knows the trick.
  Thanks for any help.</p>