Example usage for javax.xml.transform.stax StAXResult StAXResult

List of usage examples for javax.xml.transform.stax StAXResult StAXResult

Introduction

In this page you can find the example usage for javax.xml.transform.stax StAXResult StAXResult.

Prototype

public StAXResult(final XMLStreamWriter xmlStreamWriter) 

Source Link

Document

Creates a new instance of a StAXResult by supplying an XMLStreamWriter .

XMLStreamWriter must be a non-null reference.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    Document doc = null;//from   w w  w . j av a  2 s . c  o m
    XMLStreamWriter writer = XMLOutputFactory.newFactory().createXMLStreamWriter(System.out);
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.transform(new DOMSource(doc), new StAXResult(writer));
}

From source file:org.javelin.sws.ext.bind.SweJaxbMarshaller.java

@Override
public void marshal(Object jaxbElement, XMLStreamWriter writer) throws JAXBException {
    this.marshal(jaxbElement, new StAXResult(writer));
}

From source file:org.geosdi.geoplatform.json.jaxb.GPJsonJaxbMarshaller.java

@Override
public void marshal(Object jaxbElement, File output) throws IOException {
    Configuration config = new Configuration();
    MappedNamespaceConvention con = new MappedNamespaceConvention(config);
    Writer writer = new OutputStreamWriter(new FileOutputStream(output));

    XMLStreamWriter xmlStreamWriter = new MappedXMLStreamWriter(con, writer);

    this.marshaller.marshal(jaxbElement, new StAXResult(xmlStreamWriter));
}

From source file:org.geosdi.geoplatform.json.jaxb.GPJsonJaxbMarshaller.java

@Override
public void marshal(Object jaxbElement, Writer writer) throws IOException {
    Configuration config = new Configuration();
    MappedNamespaceConvention con = new MappedNamespaceConvention(config);

    XMLStreamWriter xmlStreamWriter = new MappedXMLStreamWriter(con, writer);

    this.marshaller.marshal(jaxbElement, new StAXResult(xmlStreamWriter));
}