java: Adding recursively to an xml
<p>I need a help. how can i add content recursively to an xml file. i have a program which processes a file and send  'line information's. these line informations needs to be written to an XML file, like shown below. what i do now is I read each line info and then send it a fn which writes XML. I want to know if there is any way to Buffer the Document object and then keep keeping appending to that Document object when each new line comes. </p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no" ?&gt; 
- &lt;Rev_1.28&gt;
- &lt;OP type="SAM"&gt;
  &lt;SRC_LN_FROM&gt;612612&lt;/SRC_LN_FROM&gt; 
  &lt;SRC_LN_TO&gt;703703&lt;/SRC_LN_TO&gt; 
  &lt;NO_LINES&gt;92&lt;/NO_LINES&gt; 
  &lt;/OP&gt;
- &lt;OP type="MOV"&gt;
  &lt;SRC_LN_FROM&gt;6122&lt;/SRC_LN_FROM&gt; 
  &lt;SRC_LN_TO&gt;7033&lt;/SRC_LN_TO&gt; 
  &lt;NO_LINES&gt;9&lt;/NO_LINES&gt; 
  &lt;/OP&gt;
  &lt;/Rev_1.28&gt;
</code></pre>
