Package org.apache.axiom.om

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


        assertTrue("Serialized text error" + result, result.indexOf("1930110111") > 0);

        // Serialize again
        writer = new StringWriter();
        xmlwriter = StAXUtils.createXMLStreamWriter(writer);
        root.serialize(writer);
        xmlwriter.flush();
        result = writer.toString();

        assertTrue(element.getLocalName().equals("library"));
        assertTrue(element.getNamespace().getNamespaceURI().equals(""));
View Full Code Here


        // Serialize and cache.  This should cause expansion and update the name to match the testDocument string
        StringWriter writer = new StringWriter();
        XMLStreamWriter xmlwriter = StAXUtils.createXMLStreamWriter(writer);

        try {
            root.serialize(writer);
        } catch (Exception e) {
            // Current Behavior
            // The current OMSourceElementImpl ensures that the namespace and localName
            // are consistent with the original setting.
            return;
View Full Code Here

        assertTrue("Serialized text error" + result, result.indexOf("1930110111") > 0);

        // Serialize again
        writer = new StringWriter();
        xmlwriter = StAXUtils.createXMLStreamWriter(writer);
        root.serialize(writer);
        xmlwriter.flush();
        result = writer.toString();

        assertTrue(element.getLocalName().equals("library"));
        assertTrue(element.getNamespace().getNamespaceURI().equals(
View Full Code Here

        OMElement element = new OMSourcedElementImpl("element", null, f, ds);
       
        element.getFirstElement().setText("TEST");
       
        StringWriter sw = new StringWriter();
        element.serialize(sw);
        assertTrue(sw.toString().indexOf("TEST") != -1);
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        element.serialize(baos);
        assertTrue(new String(baos.toByteArray(), "UTF-8").indexOf("TEST") != -1);
View Full Code Here

        StringWriter sw = new StringWriter();
        element.serialize(sw);
        assertTrue(sw.toString().indexOf("TEST") != -1);
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        element.serialize(baos);
        assertTrue(new String(baos.toByteArray(), "UTF-8").indexOf("TEST") != -1);
       
        assertTrue(element.toString().indexOf("TEST") != -1);
    }
View Full Code Here

        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(baos, oof);
       
        OMXMLParserWrapper builder =
            OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments);
        OMElement om = builder.getDocumentElement();
        om.serialize(writer);
        om.close(false);
        String outNormal = baos.toString();
       
        assertTrue(outNormal.indexOf("base64") == -1);
       
View Full Code Here

                        Boolean.TRUE);
        writer = new MTOMXMLStreamWriter(baos, oof);
        builder =
            OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments);
        om = builder.getDocumentElement();
        om.serialize(writer);
        om.close(false);
        String outBase64 = baos.toString();
       
       
        // Do a quick check to see if the data is base64 and is
View Full Code Here

                        Boolean.FALSE);
        writer = new MTOMXMLStreamWriter(baos, oof);
        builder =
            OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments2);
        om = builder.getDocumentElement();
        om.serialize(writer);
        om.close(false);
        String outBase64ToNormal = baos.toString();
       
        assertTrue(outBase64ToNormal.indexOf("base64") == -1);
       
View Full Code Here

                        Boolean.TRUE);
        writer = new MTOMXMLStreamWriter(baos, oof);
        builder =
            OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments2);
        om = builder.getDocumentElement();
        om.serialize(writer);
        om.close(false);
        String outBase64ToBase64 = baos.toString();
       
        // Do a quick check to see if the data is base64 and is
        // writing base64 compliant code.
View Full Code Here

       
        // Get the root
        SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(attachments.getRootPartInputStream(), "UTF-8");
        OMElement root = builder.getDocumentElement();
        StringWriter xmlWriter = new StringWriter();
        root.serialize(xmlWriter);
       
        // Serialize the message using the legacy behavior (order by content id)
        OMOutputFormat format = new OMOutputFormat();
        format.setCharSetEncoding("utf-8");
        format.setDoingSWA(true);
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.