final AttributesImpl attribs = new AttributesImpl();
// iterate validation report items, write message
final List<ValidationReportItem> cr = report.getValidationReportItemList();
for (final Iterator<ValidationReportItem> iter = cr.iterator(); iter.hasNext();) {
final ValidationReportItem vri = iter.next();
// construct attributes
attribs.addAttribute("", "level", "level", "CDATA", vri.getTypeText());
attribs.addAttribute("", "line", "line", "CDATA", Integer.toString(vri.getLineNumber()));
attribs.addAttribute("", "column", "column", "CDATA", Integer.toString(vri.getColumnNumber()));
if (vri.getRepeat() > 1) {
attribs.addAttribute("", "repeat", "repeat", "CDATA", Integer.toString(vri.getRepeat()));
}
// write message
builder.startElement("", "message", "message", attribs);
builder.characters(vri.getMessage());
builder.endElement();
// Reuse attributes
attribs.clear();
}