public void marshal(Object obj, XMLStreamWriter writer) throws JAXBException {
// Very easy, use the Context to get the Marshaller.
// Use the marshaller to write the object.
Marshaller m = JAXBContextHelper.getMarshaller(getJAXBContext());
AttachmentMarshaller am = m.getAttachmentMarshaller();
boolean xop = am != null ? am.isXOPPackage() : false;
// Marshal the object
marshalElement(obj, m, writer, !xop);
}