Writer writer = new StringWriter();
try {
Marshaller.marshal(aw, writer);
} catch (MarshalException e) {
Logger.error(Serializer.class, e.getMessage(), e);
throw new CastorException(e.getMessage());
} catch (ValidationException e) {
Logger.error(Serializer.class, e.getMessage(), e);
throw new CastorException(e.getMessage());
}
return writer.toString();
}