Element () { Element state = new Element("previewData"); for (String key : myPreviewMap.keySet()) { String value = myPreviewMap.get(key); if (value != null) { Element previewRec = new Element(PREVIEW_RECORD_TAG); previewRec.setAttribute(EDITORCONFIG_FILE_ATTR, key); previewRec.setAttribute(PREVIEW_FILE_ATTR, value); state.addContent(previewRec); } } return state; }