following is my java code for reading a xml file and updating some values in it.
public static void writeLexicon(String word, String tag) {
int newFreq
This is a relatively common problem with many applications, not just JDOM.
When you create a FileOutputStream, and write to it, you HAVE TO FLUSH IT AND CLOSE IT before exiting your program.
Change:
xmlOutput.output(doc, new FileOutputStream(new File("./src/Lexicon.xml")));
to be (using try-with-resources):
try (OutputStream fileout = new FileOutputStream(new File("./src/Lexicon.xml"))) {
xmlOutput.output(doc, fileout);
}
or:
OutputStream fileout = new FileOutputStream(new File("./src/Lexicon.xml"));
xmlOutput.output(doc, fileout);
fileout.flush();
fileout.close();