try {
QName xmlType = getXmlType();
Serializer serializer = getSerializer(xmlType);
StringWriter writer = new StringWriter();
SerializationContext context = new SerializationContext(writer);
serializer.serialize(
xmlType, null, reportDefinition, context);
return sanitize(writer.toString());
} catch (IllegalArgumentException e) {
throw new SerializationException("Could not serialize report.", e);
} catch (SecurityException e) {