String attrName = textToSafeAttrName(colName);
resultSet.setColName(col, attrName);
}
}
XmlSerializer xml = XMLUtils.getXmlSerializer(whitespace);
xml.setOutput(outStream, ENCODING);
xml.startDocument(ENCODING, null);
xml.startTag(null, RESULT_SET_TAG);
for (int row = 1; row <= resultSet.numRows(); row++) {
xml.startTag(null, RESULT_ITEM_TAG);
xml.attribute(null, PATH_ATTR, resultSet.getRowName(row));
for (int col = 1; col <= resultSet.numCols(); col++) {
String name = resultSet.getColName(col);
SimpleData d = resultSet.getData(row, col);
String value = (d == null ? null : d.format());
if (inlineAttributes) {
if (value != null)
xml.attribute(null, name, value);
} else {
xml.startTag(null, RESULT_DATA_TAG);
xml.attribute(null, NAME_ATTR, name);
if (value != null)
xml.attribute(null, VALUE_ATTR, value);
xml.endTag(null, RESULT_DATA_TAG);
}
}
xml.endTag(null, RESULT_ITEM_TAG);
}
xml.endTag(null, RESULT_SET_TAG);
xml.endDocument();
}