title: modify xml file with Stax API Java
body: <p>I'm very new in XML, and I try to modify an xml file.
  Let  me explain what I want do. I have an existing file, in wich are writed few  lines, but i want to keep them and add other ones. </p>
  
  <p>My example is not working in the way I want. It's delete every thing, and write a new XML.</p>
  
  <p>What I need to read to know how to do that?</p>
  
  <p>This is my java code:</p>
  
  <pre><code>public static void WriteFile(){
            try{
                XMLOutputFactory  xMLOutputFactory  = XMLOutputFactory.newFactory();
                XMLStreamWriter xMLStreamWriter = xMLOutputFactory.
                        createXMLStreamWriter(new FileOutputStream("src\\data\\orders.xml"));
                xMLStreamWriter.writeStartDocument("1.0");
                xMLStreamWriter.writeStartElement("products");
                xMLStreamWriter.writeStartElement("product");
  
                //set description
                xMLStreamWriter.writeStartElement("description");
                xMLStreamWriter.writeCharacters("Apple MacBook Air A 11.6 Mac OS X v10.7 Lion MacBook");
                xMLStreamWriter.writeEndElement();
                 //end description
  
                //set price
                xMLStreamWriter.writeStartElement("price");
                xMLStreamWriter.writeAttribute("currency","USD");
                xMLStreamWriter.writeCharacters("999");
                xMLStreamWriter.writeEndElement();
                //end price
  
                xMLStreamWriter.writeEndElement();
                //end produtcs
                xMLStreamWriter.writeEndElement();
                //end produtc
                xMLStreamWriter.flush();
                xMLStreamWriter.close();
            }catch (Exception e){
                System.out.println(e.getMessage());
            }
        }
  </code></pre>