}
}
Object oxmObject = validateAndTransformIfNeeded(object); // xml bindings + object
try {
XMLEventWriterRecord record = new XMLEventWriterRecord(eventWriter);
record.setMarshaller(this.xmlMarshaller);
this.xmlMarshaller.marshal(oxmObject, record);
} catch (BeanValidationException bve) {
throw new MarshalException(bve.getMessage(), String.valueOf(bve.getErrorCode()), bve);
} catch (Exception ex) {
throw new MarshalException(ex);