Element (Map<String, String> map) { Element registryElement = new Element("registry"); for (Map.Entry<String, String> entry : map.entrySet()) { Element entryElement = new Element("entry"); entryElement.setAttribute("key", entry.getKey()); entryElement.setAttribute("value", entry.getValue()); registryElement.addContent(entryElement); } return registryElement; }