title: How do I modify an XML element using StAX in Java
body: <p>I want to modify my name in xml cv file, but when I use this statement:</p>
  
  <pre><code>XMLOutputFactory xof = XMLOutputFactory.newInstance();
  XMLStreamWriter xtw = null;
  xtw = xof.createXMLStreamWriter(new FileWriter("eman.xml"));
  </code></pre>
  
  <p>all the content of the file are removed and it becomes empty. Basically, I want to open (eman.xml) for modification without removing its content.</p>