Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMElement.serializeAndConsume()


                                .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);

                format.setDoOptimize(false);
                format.setDoingSWA(false);
                format.setCharSetEncoding(charSetEnc);
                outputMessage.serializeAndConsume(out, format);
                out.flush();
            } catch (Exception e) {
                throw AxisFault.makeFault(e);
            }
        } else {
View Full Code Here


        if (contentType == SPINE) {
            getContentAsXMLSpine().outputTo(writer, consume);
        } else {
            OMElement omElement = getContentAsOMElement();
            if (consume) {
                omElement.serializeAndConsume(writer);
            } else {
                omElement.serialize(writer);
            }
        }
        setConsumed(consume);
View Full Code Here

        OMElement om = m.getAsOMElement();

        // Serialize the Envelope using the same mechanism as the
        // HTTP client.
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        om.serializeAndConsume(baos, new OMOutputFormat());

        // To check that the output is correct, get the String contents of the
        // reader
        String newText = baos.toString();
        TestLogger.logger.debug(newText);
View Full Code Here

        OMElement om = m.getAsOMElement();
               
        // Serialize the Envelope using the same mechanism as the
        // HTTP client.
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        om.serializeAndConsume(baos, new OMOutputFormat());
       
        // To check that the output is correct, get the String contents of the
        // reader
        String newText = baos.toString();
        TestLogger.logger.debug(newText);
View Full Code Here

        OMElement om = m.getAsOMElement();
               
        // Serialize the Envelope using the same mechanism as the
        // HTTP client.
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        om.serializeAndConsume(baos, new OMOutputFormat());
       
        // To check that the output is correct, get the String contents of the
        // reader
        String newText = baos.toString();
        TestLogger.logger.debug(newText);
View Full Code Here

        StringReader reader = new StringReader(testString);
        XMLStreamReader xmlStreamReader
            = new WrappedTextNodeStreamReader(wrapperElementName, reader, chunkSize);
        OMElement element = new StAXOMBuilder(xmlStreamReader).getDocumentElement();
        StringWriter writer = new StringWriter();
        element.serializeAndConsume(writer);
        assertXMLEqual(expectedXML, writer.toString());
    }
   
    public void testShortStringUsingSerializeAndConsume() throws Exception {
        String testString = "This is a test string for WrappedTextNodeStreamReader";
View Full Code Here

            format.setSOAP11(msgContext.isSOAP11());
            format.setCharSetEncoding(
                    getProperty(msgContext, Constants.Configuration.CHARACTER_SET_ENCODING));
            format.setDoOptimize(msgContext.isDoingMTOM());
            try {
                msgElement.serializeAndConsume(baos, format);
                baos.flush();
            } catch (XMLStreamException e) {
                handleException("XML serialization error creating BytesMessage", e);
            } catch (IOException e) {
                handleException("IO Error while creating BytesMessage", e);
View Full Code Here

        JAXB2OMElement t1 = new JAXB2OMElement(registry);
        OMElement om = t1.transform(po, tContext);
        long duration1 = System.currentTimeMillis() - start;
        StringWriter sw = new StringWriter();
        // serializeAndConsume() will trigger the JAXBDataSource.serialize(Writer, OMOutputFormat)
        om.serializeAndConsume(sw);
        System.out.println(sw.toString());

        start = System.currentTimeMillis();
        Node node = new JAXB2Node(new DefaultExtensionPointRegistry()).transform(po, tContext);
        XMLStreamReader reader = new Node2XMLStreamReader().transform(node, null);
View Full Code Here

        start = System.currentTimeMillis();
        Node node = new JAXB2Node(new DefaultExtensionPointRegistry()).transform(po, tContext);
        XMLStreamReader reader = new Node2XMLStreamReader().transform(node, null);
        om = new StAXOMBuilder(reader).getDocumentElement();
        sw = new StringWriter();
        om.serializeAndConsume(sw);
        long duration2 = System.currentTimeMillis() - start;
        System.out.println(sw.toString());
        System.out.println(duration1 + " vs. " + duration2);
    }
View Full Code Here

        TransformationContext tContext = new TransformationContextImpl();
        tContext.setSourceDataType(sourceDataType);
        tContext.setTargetDataType(targetDataType);
        OMElement om = new JAXB2OMElement(new DefaultExtensionPointRegistry()).transform(po.getValue(), tContext);
        StringWriter sw = new StringWriter();
        om.serializeAndConsume(sw);
        System.out.println(sw.toString());
    }

    private JAXBElement<PurchaseOrderType> createPO() {
        ObjectFactory factory = new ObjectFactory();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.