I have an XML File that looks like this:
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<allinfo>
<filepath>/mnt/sdcard/Audio_Recorder/</filepath>
<filename>newxml35500.3gp</filename>
<annotation>
<file>newxml35500.3gp</file>
<timestamp>0:05</timestamp>
<note>uuuouou</note>
</annotation>
<filepath>/mnt/sdcard/Audio_Recorder/</filepath>
<filename>newxml35501.3gp</filename>
<annotation>
<file>newxml35501.3gp</file>
<timestamp>0:04</timestamp>
<note>tyty</note>
</annotation>
</allinfo>
I am trying to add an addition annotation to the XML after it has been created so the XML has an additional:
<annotation>
<file>blah</file>
<timestamp>0:00</timestamp>
<note>this is a note</note>
</annotation>
What is the best way to find the root and then write a few lines to the XML in Java? I have seen DocumentBuilderFactory get some use from others but I am not sure how to implement it correctly. Any help would be much appreciated.
This works:
You will get: