private Xpp3Dom toDom(Xpp3Dom parent, Map<Object, Object> map) { for (Map.Entry<Object, Object> entry : map.entrySet()) { String key = entry.getKey().toString(); Object entryValue = entry.getValue(); Xpp3Dom child = new Xpp3Dom(key); if (key.startsWith(ATTRIBUTE_PREFIX)) { toAttribute(parent, key.replace(ATTRIBUTE_PREFIX, ""), entryValue); continue; } // lists need the insertion of intermediate XML DOM nodes which hold the actual values if (entryValue instanceof List && !((List) entryValue).isEmpty()) { toDom(child, key, (List) entryValue); } else if (entryValue instanceof Map) { //noinspection unchecked child = toDom(child, (Map) entryValue); } else { // if not a list or map then copy the string value child.setValue(entryValue.toString()); } parent.addChild(child); } return parent; }
private Xpp3Dom toDom(Xpp3Dom parent, Map<Object, Object> map) { for (Map.Entry<Object, Object> entry : map.entrySet()) { String key = entry.getKey().toString(); Object entryValue = entry.getValue(); Xpp3Dom child = new Xpp3Dom(key); if (key.startsWith(ATTRIBUTE_PREFIX)) { toAttribute(parent, key.replace(ATTRIBUTE_PREFIX, ""), entryValue); continue; } // lists need the insertion of intermediate XML DOM nodes which hold the actual values if (entryValue instanceof List && !((List) entryValue).isEmpty()) { toDom(child, key, (List) entryValue); } else if (entryValue instanceof Map) { //noinspection unchecked child = toDom(child, (Map) entryValue); } else { // if not a list or map then copy the string value child.setValue(entryValue.toString()); } parent.addChild(child); } return parent; }
public Object construct(Node node) { Map<Object, Object> mapping = constructMapping((MappingNode) node); Xpp3Dom parent = new Xpp3Dom("configuration"); return toDom(parent, mapping); }
public Object construct( Node node ) { return toDom( constructMapping( (MappingNode) node ) ); }
public Object construct( Node node ) { return toDom( constructMapping( (MappingNode) node ) ); }
public Object construct(Node node) { Map<Object, Object> mapping = constructMapping((MappingNode) node); Xpp3Dom parent = new Xpp3Dom("configuration"); return toDom(parent, mapping); }