HashTree sorted = sortDataElements(dataElements);
writeDataElements(new OutputStreamWriter(out, ENCODING), sorted);
}
private HashTree sortDataElements(Iterator dataElements) {
HashTree result = new HashTree(TreeMap.class);
while (dataElements.hasNext()) {
ExportedDataValue v = (ExportedDataValue) dataElements.next();
String name = v.getName();
SimpleData simpleValue = v.getSimpleValue();
if (simpleValue != null)
result.put(name, simpleValue);
}
return result;
}