dialogTitle = "Parent Record " + val.getName().getLocalPart();
Iterator<XmlObject> iter = val.getChildren();
Hashtable<String, Object> row = new Hashtable<String, Object>();
ArrayList<String> rowsNames = new ArrayList<String>();
while (iter.hasNext()) {
XmlObject field = iter.next();
if (!XmlConstants.ELEM_TYPE.equals(field.getName().getLocalPart())
&& !rowsNames.contains(field.getName().getLocalPart())) {
if (field.getValue() != null) {
columnNames.put(field.getName().getLocalPart(), field.getName().getLocalPart());
}
Object fieldVal = field.getValue();
if (fieldVal == null) {
fieldVal = "";
}
row.put(field.getName().getLocalPart(), fieldVal);
rowsNames.add(field.getName().getLocalPart());
}
}
rows.add(row);
} else {
Iterator<XmlObject> iter = val.getChildren();
while (iter.hasNext()) {
XmlObject oneElement = iter.next();
dialogTitle = "Child records for " + val.getName().getLocalPart();
if ("records".equals(oneElement.getName().getLocalPart())) {
Iterator<XmlObject> children = oneElement.getChildren();
Hashtable<String, Object> row = new Hashtable<String, Object>();
ArrayList<String> rowsNames = new ArrayList<String>();
while (children.hasNext()) {
XmlObject field = children.next();
if (!XmlConstants.ELEM_TYPE.equals(field.getName().getLocalPart())
&& !rowsNames.contains(field.getName().getLocalPart())) {
if (field.getValue() != null) {
columnNames.put(field.getName().getLocalPart(), field.getName().getLocalPart());
}
Object fieldVal = field.getValue();
if (fieldVal == null) {
fieldVal = "";
}
row.put(field.getName().getLocalPart(), fieldVal);
}
}
rows.add(row);
}
}