title: Convert Element(org.w3c.dom) to String in Java
body: <p>I'm having a small issue of converting Element object to String. Because I need a string to be passed to a particular method. I've tried by using .toString() or using a String variable assigning to it. None of the trials were correct. How can we easily convert and the string object also should show the exact XML structure as it is showing for Element.</p>
  
  <pre><code>Element element = (Element) xmlList.item(i);
  </code></pre>
  
  <p>The above "element" object shows in XML format. I want to convert the same in String in XML format</p>