XML file is not updating using the jdom
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=0; int tagAvailability = 0; int wordAvaialbility = 0; try { if (new File("./src/Lexicon.xml").exists()) { Document readDoc = getXMLFile(); Element root = readDoc.getRootElement(); for (Element curElem : root.getChildren("lexiconElement")) { if (word.equals(curElem.getChildText("word"))) { // word avaialble List<Element> subEle = curElem.getChildren(); for (int i = 1; i < subEle.size(); i++) { if (tag.equals(subEle.get(i).getChildText("tag"))) {