Implements Closeable Interface, getOrAdd() method new
When processing many XML documents you must free memory after each document. This can be performed by the close() method. Using Java 8 you can use the new try(...) syntax. Refactoring needed! You may get warnings that there's a missing close() call. Your code will still work without closing XMLDocument.
If you want to modify a potential already existing child element you can now use the "XMLElement getOrAdd(elementname)" method.