Examples of OMOutputImpl


Examples of org.apache.axis2.om.impl.OMOutputImpl

        OMDocument omDocument = getSampleOMDocument(sampleXML);

        // serialise it to a string
        String outXML = "";
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        OMOutputImpl output = new OMOutputImpl(outStream, false);
        omDocument.serialize(output);
        output.flush();
        outXML = new String(outStream.toByteArray());

        // again load that to another builder
        OMDocument secondDocument = getSampleOMDocument(outXML);
View Full Code Here

Examples of org.apache.axis2.om.impl.OMOutputImpl

            staxOMBuilder.setDoDebug(true);
            OMElement rootElement = staxOMBuilder.getDocumentElement();

            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            OMOutputImpl omOutput = new OMOutputImpl(baos, false);
            omOutput.ignoreXMLDeclaration(ignoreXMLDeclaration);

//            rootElement.serializeWithCache(omOutput);
            ((OMDocument) rootElement.getParent()).serializeWithCache(omOutput);
            omOutput.flush();

            return new String(baos.toByteArray());
        } catch (Exception e) {
            throw e;
        }
View Full Code Here

Examples of org.apache.axis2.om.impl.OMOutputImpl

            staxOMBuilder.setDoDebug(true);
            OMElement rootElement = staxOMBuilder.getDocumentElement();

            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            OMOutputImpl omOutput = new OMOutputImpl(baos, false);
//            omOutput.ignoreXMLDeclaration(ignoreXMLDeclaration);

            if (ignoreDocument) {
                rootElement.serializeWithCache(omOutput);
            } else {
                ((OMDocument) rootElement.getParent()).serializeWithCache(omOutput);
            }
            omOutput.flush();

            InputSource resultXML = new InputSource(new InputStreamReader(
                    new ByteArrayInputStream(baos.toByteArray())));

            Document dom2 = newDocument(resultXML);
View Full Code Here

Examples of org.apache.axis2.om.impl.OMOutputImpl

        XMLStreamWriter writer;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        writer = XMLOutputFactory.newInstance().
                createXMLStreamWriter(baos);

        ((OMDocument)rootElement.getParent()).serializeWithCache(new OMOutputImpl(writer));

        writer.flush();
        writer.close();

        InputSource resultXML = new InputSource(new InputStreamReader(
View Full Code Here

Examples of org.apache.axis2.om.impl.OMOutputImpl

        super.setUp();
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        ByteArrayOutputStream outStream;
        String boundary;
       
        OMOutputImpl omOutput = new OMOutputImpl(null);
        boundary = omOutput.getMimeBoundary();

        String contentType = org.apache.axis2.om.impl.MIMEOutputUtils
        .getContentTypeForMime(boundary, omOutput.getRootContentId(),
            omOutput.getCharSetEncoding(),SOAP12Constants.SOAP_12_CONTENT_TYPE);
        DataHandler dataHandler;
        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
        OMText textData = factory.createText(dataHandler, true);
        assertNotNull(textData.getContentID());
View Full Code Here

Examples of org.apache.axis2.om.impl.OMOutputImpl

  }

 
  public void testXMLDecleration() throws XMLStreamException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OMOutputImpl output = new OMOutputImpl(baos,false);
    document.serialize(output);
    output.flush();
   
    String xmlDocument = new String(baos.toByteArray());
   
    assertTrue("XML Declaration missing",-1<xmlDocument.indexOf(xmlDeclStart));
  }
View Full Code Here

Examples of org.apache.axis2.om.impl.OMOutputImpl

    assertTrue("XML Declaration missing",-1<xmlDocument.indexOf(xmlDeclStart));
  }
 
  public void testExcludeXMLDeclaration() throws XMLStreamException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OMOutputImpl output = new OMOutputImpl(baos,false);
    document.serialize(output,false);
    output.flush();
   
    String xmlDocument = new String(baos.toByteArray());
   
    assertTrue(
        "XML Declaration is included when serilizing without the declaration",
View Full Code Here

Examples of org.apache.axis2.om.impl.OMOutputImpl

        -1 == xmlDocument.indexOf(xmlDeclStart));
  }
 
  public void testCharsetEncoding() throws XMLStreamException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OMOutputImpl output = new OMOutputImpl(baos,false);
        output.ignoreXMLDeclaration(false);
        document.serialize(output);
    output.flush();

        String xmlDocument = new String(baos.toByteArray());

        assertTrue("Charset declaration missing",-1 < xmlDocument.indexOf(encoding) ||
                                                 -1 < xmlDocument.indexOf(encoding.toLowerCase()) ||
View Full Code Here

Examples of org.apache.axis2.om.impl.OMOutputImpl

                                                 -1 < xmlDocument.indexOf(encoding2));
  }
 
  public void testCharsetEncodingUTF_16() throws XMLStreamException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OMOutputImpl output = new OMOutputImpl(baos,false);
    output.setCharSetEncoding("UTF-16");
    document.serialize(output);
    output.flush();
   
    String xmlDocument = new String(baos.toByteArray());
    assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(encoding_UTF16) ||
                                                 -1<xmlDocument.indexOf(encoding2_UTF16));
  }
View Full Code Here

Examples of org.apache.axis2.om.impl.OMOutputImpl

  }
   
 
  public void testXMLVersion() throws XMLStreamException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OMOutputImpl output = new OMOutputImpl(baos,false);
    document.serialize(output);
    output.flush();
   
    String xmlDocument = new String(baos.toByteArray());
    assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(version) ||
                                                 -1<xmlDocument.indexOf(version2));
  }
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.