public Map<String, String> getNodeAttributes(Dom node, String prefix) { Map<String, String> result = new HashMap<String, String>(); for (String attrName : node.model.getAttributeNames()) { String value = (String) node.model.findIgnoreCase(attrName).get(node, String.class); if (value!=null) { result.put(attrName, value); } } for (String leafName : node.model.getLeafElementNames()) { List values = node.leafElements(leafName); Iterator i = values.iterator(); StringBuffer value = new StringBuffer(); while (i.hasNext()) { String nextValue = (String) i.next(); if (nextValue!=null) { value.append(nextValue); if(i.hasNext()) { value.append(","); } } } result.put(leafName, value.toString()); } return result; }
private void checkUnique(Dom d) { try { Set<String> eltnames = d.getElementNames(); Set<String> leafeltnames = d.model.getLeafElementNames(); for (String elt : eltnames) { if (leafeltnames.contains(elt)) continue; List<Dom> eltlist = d.nodeElements(elt); checkDuplicate(eltlist); for (Dom subelt : eltlist) { checkUnique(subelt); } } } catch(Exception e) { error = true; e.printStackTrace(); } }
for (String name : targetNode.model.getLeafElementNames()) { String finalDottedName = node.getValue() + "." + name; if (matches(finalDottedName, pattern)) {