public static XMLStreamWriter createXMLStreamWriter(OutputStream out) throws XMLStreamException { return createXMLStreamWriter(null, out); }
public static XMLStreamWriter createXMLStreamWriter(final Writer out) throws XMLStreamException { return createXMLStreamWriter(null, out); }
public static XMLStreamWriter createXMLStreamWriter(OutputStream out, String encoding) throws XMLStreamException { return createXMLStreamWriter(null, out, encoding); }
private DelegatingStreamWriter() { try { this.delegate = StAXUtils.createXMLStreamWriter(baos); } catch (XMLStreamException ex) { throw new AxiomSoapBodyException("Could not determine payload root element", ex); } }
public void serializeAndConsume(OutputStream output) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output); try { serializeAndConsume(xmlStreamWriter); } finally { xmlStreamWriter.close(); } }
public void serializeAndConsume(Writer writer) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer); try { serializeAndConsume(xmlStreamWriter); } finally { xmlStreamWriter.close(); } }
private DelegatingStreamWriter() { try { this.delegate = StAXUtils.createXMLStreamWriter(baos); } catch (XMLStreamException ex) { throw new AxiomSoapBodyException("Could not determine payload root element", ex); } }
private DelegatingStreamWriter() { try { this.delegate = StAXUtils.createXMLStreamWriter(baos); } catch (XMLStreamException ex) { throw new AxiomSoapBodyException("Could not determine payload root element", ex); } }
private DelegatingStreamWriter() { try { this.delegate = StAXUtils.createXMLStreamWriter(baos); } catch (XMLStreamException ex) { throw new AxiomSoapBodyException("Could not determine payload root element", ex); } }
public void serialize(OutputStream output) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output); try { serialize(xmlStreamWriter); } finally { xmlStreamWriter.close(); } }
public void serialize(Writer writer) throws XMLStreamException { XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer); try { serialize(xmlStreamWriter); } finally { xmlStreamWriter.close(); } }
public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { XMLStreamWriter streamWriter = StAXUtils.createXMLStreamWriter(writer); serialize(streamWriter); }
public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { XMLStreamWriter streamWriter; if (format != null && StringUtils.hasLength(format.getCharSetEncoding())) { streamWriter = StAXUtils.createXMLStreamWriter(output, format.getCharSetEncoding()); } else { streamWriter = StAXUtils.createXMLStreamWriter(output); } serialize(streamWriter); }
@Override public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter xmlWriter = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer)); xmlWriter.setOutputFormat(format); serialize(xmlWriter); xmlWriter.flush(); }
public final void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter xmlWriter = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer)); xmlWriter.setOutputFormat(format); serialize(xmlWriter); xmlWriter.flush(); }
private static final Source createSourceContent(final SOAPEnvelope envelope) throws MessagingException { final SOAPBody body = envelope.getBody(); final OMElement rootElement = body.getFirstElement(); final OMNamespace namespace = envelope.getNamespace(); final Iterator envNS = envelope.getAllDeclaredNamespaces(); final Iterator bodyNS = body.getAllDeclaredNamespaces(); Source result = null; if (rootElement != null) { rootElement.declareNamespace(namespace); while (envNS.hasNext()) { rootElement.declareNamespace((OMNamespace) envNS.next()); } while (bodyNS.hasNext()) { rootElement.declareNamespace((OMNamespace) bodyNS.next()); } try (final ByteArrayOutputStream os = new ByteArrayOutputStream();) { final XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(os); final XMLStreamWriter encoder = new XOPEncodingStreamWriter(writer, ContentIDGenerator.DEFAULT, OptimizationPolicy.ALL); rootElement.serialize(encoder); result = new BytesSource(os.toByteArray()); } catch (final XMLStreamException | IOException e) { throw new MessagingException(e); } } return result; }
public void writeTo(Base base, Writer out, WriterOptions options) throws IOException { try { XMLStreamWriter w = StAXUtils.createXMLStreamWriter(out); XMLStreamWriter pw = new PrettyStreamWriter(w); OMElement om = (base instanceof Document) ? getOMElement(((Document)base).getRoot()) : (OMElement)base; String charset = options.getCharset(); if (om.getParent() != null && om.getParent() instanceof OMDocument) { OMDocument doc = (OMDocument)om.getParent(); pw.writeStartDocument(charset != null ? charset : doc.getCharsetEncoding(), doc.getXMLVersion()); } om.serialize(pw); pw.writeEndDocument(); if (options.getAutoClose()) out.close(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }
public void serialize(Writer writer2, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils .createXMLStreamWriter(writer2)); writer.setOutputFormat(format); try { internalSerialize(writer); writer.flush(); } finally { if (format.isAutoCloseWriter()) { writer.close(); } } }
public void serializeAndConsume(Writer writer2, OMOutputFormat format) throws XMLStreamException { MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils .createXMLStreamWriter(writer2)); try { writer.setOutputFormat(format); internalSerializeAndConsume(writer); writer.flush(); } finally { if (format.isAutoCloseWriter()) { writer.close(); } } }
public void writeTo(java.io.Writer writer) throws IOException { Writer out = getFactory().getAbdera().getWriter(); if (!(out instanceof FOMWriter)) { out.writeTo(this, writer); } else { try { OMOutputFormat outputFormat = new OMOutputFormat(); if (this.getCharsetEncoding() != null) outputFormat.setCharSetEncoding(this.getCharsetEncoding()); MTOMXMLStreamWriter omwriter = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer)); omwriter.setOutputFormat(outputFormat); this.internalSerialize(omwriter); omwriter.flush(); } catch (XMLStreamException e) { throw new FOMException(e); } } }