Remove prop.addContent(prop)
following code block creates a clone of root element and detaches it.
org.jdom2.Document doc = new SAXBuilder().build(xmlFile);
Element root = doc.getRootElement().clone();
root.detach();
This is the reason your doc is not getting updated. Two Options:
- try creating a new document with the cloned root and write that to your file
- add the content to existing root element
Hope this helps.