marshalDomResult(graph, (DOMResult) result); else if (TraxUtils.isStaxResult(result)) { marshalStaxResult(graph, result);
public void marshal(Object graph, Result result, MimeContainer mimeContainer) throws XmlMappingException { try { Marshaller marshaller = createMarshaller(); if (mtomEnabled && mimeContainer != null) { marshaller.setAttachmentMarshaller(new Jaxb2AttachmentMarshaller(mimeContainer)); } if (TraxUtils.isStaxResult(result)) { marshalStaxResult(marshaller, graph, result); } else { marshaller.marshal(graph, result); } } catch (JAXBException ex) { throw convertJaxbException(ex); } }
public void marshal(Object graph, Result result) { if (TraxUtils.isStaxResult(result)) { XMLStreamWriter streamWriter = TraxUtils.getXMLStreamWriter(result); if (streamWriter != null) { result = new StaxResult(streamWriter); } else { XMLEventWriter eventWriter = TraxUtils.getXMLEventWriter(result); if (eventWriter != null) { result = new StaxResult(eventWriter); } else { throw new IllegalArgumentException( "StAXResult contains neither XMLStreamWriter nor XMLEventWriter"); } } } try { createMarshaller().marshal(graph, result); } catch (JAXBException ex) { throw convertJaxbException(ex); } }