Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMText


        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        for (int b = is.read(); b >= 0; b = is.read()) {
            outputStream.write((byte) b);
        }
        String base64Enc = Base64.encode(outputStream.toByteArray());
        OMText zipContent = _factory.createOMText(base64Enc, "application/zip", true);
        root.addChild(namePart);
        root.addChild(zipPart);
        zipPart.addChild(zipElmt);
        zipElmt.addChild(zipContent);
View Full Code Here


        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        for (int b = is.read(); b >= 0; b = is.read()) {
            outputStream.write((byte) b);
        }
        String base64Enc = Base64.encode(outputStream.toByteArray());
        OMText zipContent = _factory.createOMText(base64Enc, "application/zip", true);
        root.addChild(namePart);
        root.addChild(zipPart);
        zipPart.addChild(zipElmt);
        zipElmt.addChild(zipContent);
View Full Code Here

    private void processText(XMLStreamReader parser, OMElement value) {
        try {
            int token = parser.next();
            while (token != XMLStreamReader.END_ELEMENT) {
                if (token == XMLStreamReader.CHARACTERS) {
                    OMText text = factory.createOMText(value, parser.getText());
                    value.addChild(text);
                } else {
                    throw new SOAPProcessingException(
                            "Only Characters are allowed here");
                }
View Full Code Here

      OMFactory llomFactory = OMAbstractFactory.getOMFactory();
      String text = "This was a DOOM Text";
     
      OMElement llomRoot = llomFactory.createOMElement("root",null);
     
      OMText doomText = doomFactory.createOMText(text);
      llomRoot.addChild(doomText);
     
      OMElement newElement = (new StAXOMBuilder(this.factory, llomRoot
        .getXMLStreamReader())).getDocumentElement();
    newElement.build();
View Full Code Here

                "http://www.example.org/stuff", "m");
        OMElement data = new OMElementImpl("data", dataName, fac);

        FileDataSource dataSource = new FileDataSource(getTestResourceFile(imageInFileName));
        expectedDH = new DataHandler(dataSource);
        OMText binaryNode = new OMTextImpl(expectedDH, true, fac);

        envelope.addChild(body);
        body.addChild(data);
        data.addChild(binaryNode);
View Full Code Here

                .getSOAPPartInputStream())));
        builder = new MTOMStAXSOAPModelBuilder(reader, attachments, null);
        OMElement root = builder.getDocumentElement();
        OMElement body = (OMElement) root.getFirstOMChild();
        OMElement data = (OMElement) body.getFirstOMChild();
        OMText blob = (OMText) data.getFirstOMChild();
        /*
         * Following is the procedure the user has to follow to read objects in
         * OBBlob User has to know the object type & whether it is serializable.
         * If it is not he has to use a Custom Defined DataSource to get the
         * Object.
         */

        DataHandler actualDH;
        actualDH = (DataHandler)blob.getDataHandler();
        BufferedImage bufferedImage = ImageIO.read(actualDH.getDataSource().getInputStream());
        this.saveImage("image/jpeg",bufferedImage, new FileOutputStream(imageOutFileName) );
    }
View Full Code Here

                && XOP_NAMESPACE_URI
                .equalsIgnoreCase(namespaceURI)) {
            // do we need to check prfix as well. Meaning, should it be "XOP" ?


            OMText node;
            if (lastNode == null) {
                // Decide whether to ckeck the level >3 or not
                throw new OMException(
                        "XOP:Include element is not supported here");
            }
View Full Code Here

     * @see org.apache.axiom.om.OMElement#getText()
     */
    public String getText() {
        String childText = "";
        OMNode child = this.getFirstOMChild();
        OMText textNode;

        while (child != null) {
            if (child.getType() == OMNode.TEXT_NODE) {
                textNode = (OMText) child;
                if (textNode.getText() != null
                        && !"".equals(textNode.getText())) {
                    childText += textNode.getText();
                }
            }
            child = child.getNextOMSibling();
        }

View Full Code Here

    }

    public QName getTextAsQName() {
        String childText = "";
        OMNode child = this.getFirstOMChild();
        OMText textNode;

        while (child != null) {
            if (child.getType() == OMNode.TEXT_NODE) {
                textNode = (OMText) child;
                if (textNode.getText() != null
                        && !"".equals(textNode.getText())) {
                    String namespaceURI = textNode.getTextAsQName().getNamespaceURI();
                    if (namespaceURI != null && !"".equals(namespaceURI)) {
                        return textNode.getTextAsQName();
                    }
                    childText += textNode.getText();
                }
            }
            child = child.getNextOMSibling();
        }
View Full Code Here

    public void testCreateText() {
        OMElement omElement = omFactory.createOMElement("chinthaka",
                namespace);
        String text = "sampleText";
        OMText omText = omFactory.createOMText(omElement, text);
        assertTrue("Programatically created OMText should have done = true ",
                omText.isComplete());
        assertTrue(
                "Programatically created OMText should have correct text value ",
                text.equals(omText.getText()));

    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMText

Copyright © 2018 www.massapicom. 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.