How to append XML string to existing XML file using JAXB?
<p>I would like to append a <code>String</code> representing an XML element to an existing XML file using JAXB.</p>

<p>For example, I have below XML in a single <code>String</code> variable:</p>

<pre><code>&lt;servername&gt;aaaaaa&lt;/servername&gt;
&lt;ipaddress&gt;121212121&lt;/ipaddress&gt;
&lt;port&gt;8080&lt;/port&gt;
</code></pre>

<p>And I want to include this in another <code>&lt;server&gt;</code> tag in my XML.<br>
My existing XML file has this contents:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&lt;servers&gt;
    &lt;server&gt;
        &lt;servername&gt;bbbbbb&lt;/servername&gt;
        &lt;ipaddress&gt;11.11.11.11&lt;/ipaddress&gt;
        &lt;port&gt;8080&lt;/port&gt;
    &lt;/server&gt;
&lt;/servers&gt;
</code></pre>

<p>And I would like to add the contents of the <code>String</code> variable to this file so that its contents becomes as follows:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&lt;servers&gt;
    &lt;server&gt;
        &lt;servername&gt;bbbbbb&lt;/servername&gt;
        &lt;ipaddress&gt;11.11.11.11&lt;/ipaddress&gt;
         &lt;port&gt;8080&lt;/port&gt;
    &lt;/server&gt;
    &lt;server&gt;
         &lt;servername&gt;aaaaaa&lt;/servername&gt;
         &lt;ipaddress&gt;121212121&lt;/ipaddress&gt;
         &lt;port&gt;8080&lt;/port&gt;
    &lt;/server&gt;
&lt;/servers&gt;
</code></pre>

<p>How can I achieve this with JAXB?</p>