Examples of OMText


Examples of org.apache.axiom.om.OMText

    OMNode textNode = el.getFirstOMChild();
    if (textNode.getType() != OMNode.TEXT_NODE) {
      log.error("Text Node not found");
      return null;
    }
    OMText text = (OMText) textNode;
    return text.getText();
  }
View Full Code Here

Examples of org.apache.axiom.om.OMText

  }

  public static void setTextPayload(SOAPEnvelope envelope, String text) {
    OMFactory fac = envelope.getOMFactory();
    OMElement textElt = envelope.getOMFactory().createOMElement(TEXTELT);
    OMText textNode = fac.createOMText(text);
    textElt.addChild(textNode);
    setXMLPayload(envelope, textElt);
  }
View Full Code Here

Examples of org.apache.axiom.om.OMText

        HessianTestHelper hessianTestHelper = new HessianTestHelper();
        MessageContext msgContext = hessianTestHelper.createAxis2MessageContext(synEnv);
        OMElement element = hessianTestHelper.buildHessianTestMessage(testMessageName, msgContext);
        OMNode hessianNode = element.getFirstOMChild();
        OMText hessianTextNode = (OMText) hessianNode;
        SynapseBinaryDataSource synapseBinaryDataSource = (SynapseBinaryDataSource)
            ((DataHandler) hessianTextNode.getDataHandler()).getDataSource();
        InputStream inputStream = synapseBinaryDataSource.getInputStream();
        byte[] originalByteArray = IOUtils.toByteArray(getClass().getResourceAsStream(
                testMessageName));
        byte[] builderByteArray = IOUtils.toByteArray(inputStream);
        assertTrue(Arrays.equals(originalByteArray, builderByteArray));
View Full Code Here

Examples of org.apache.axiom.om.OMText

                } else if (o instanceof Byte) {
                    entry.addAttribute(TYPE, BYTE, attrNS);
                    entry.setText(o.toString());
                } else if (o instanceof byte[]) {
                    entry.addAttribute(TYPE, BYTEARRAY, attrNS);
                    OMText text = fac.createOMText(new DataHandler(
                            new ByteArrayDataSource((byte[]) o)), true);
                    entry.addChild(text);
                } else if (o instanceof Float) {
                    entry.addAttribute(TYPE, FLOAT, attrNS);
                    entry.setText(o.toString());
View Full Code Here

Examples of org.apache.axiom.om.OMText

                    }
                    OMNode data = child.getFirstOMChild();
                    if (data.getType() != OMNode.TEXT_NODE) {
                        continue; // BAD!
                    }
                    OMText text = (OMText)data;
                    if (type.equals(INTEGER)) {
                        this.put(name, new Integer(text.getText()));
                    } else if (type.equals(CHAR)) {
                        this.put(name, (text.getText().charAt(0)));
                    } else if (type.equals(DOUBLE)) {
                        this.put(name, new Double(text.getText()));
                    } else if (type.equals(FLOAT)) {
                        this.put(name, new Float(text.getText()));
                    } else if (type.equals(BYTE)) {
                        this.put(name, text.getText().getBytes()[0]);
                    } else if (type.equals(SHORT)) {
                        this.put(name, new Short(text.getText()));
                    } else if (type.equals(LONG)) {
                        this.put(name, new Long(text.getText()));
                    } else if (type.equals(STRING)) {
                        this.put(name, text.getText());
                    } else if (type.equals(BYTEARRAY)) {
                        DataHandler dh = (DataHandler) text.getDataHandler();
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        try {
                            dh.writeTo(baos);
                            this.put(name, baos.toByteArray());
                        } catch (IOException e) {
View Full Code Here

Examples of org.apache.axiom.om.OMText

        if (child != null) {
          _copyElement(element, child);
          dest.addChild(child);
        }
      } else if (node.getType() == OMNode.CDATA_SECTION_NODE) {
        OMText text = (OMText) node;
        factory.createOMText(dest,text.getText(), OMNode.CDATA_SECTION_NODE);
      } else if (node.getType() == OMNode.TEXT_NODE) {
        OMText text = (OMText) node;
        factory.createOMText(dest,text.getText());
      } else if (node.getType() == OMNode.COMMENT_NODE) {
        OMComment comment = (OMComment) node;
        factory.createOMComment(dest, comment.getValue());
      } else if (node.getType() == OMNode.PI_NODE) {
        OMProcessingInstruction pi = (OMProcessingInstruction) node;
        factory.createOMProcessingInstruction(dest, pi.getTarget(), pi.getValue());
      } else if (node.getType() == OMNode.SPACE_NODE) {
        OMText text = (OMText) node;
        factory.createOMText(dest, text.getText(), OMNode.SPACE_NODE);
      } else if (node.getType() == OMNode.ENTITY_REFERENCE_NODE) {
        OMText text = (OMText) node;
        factory.createOMText(dest, text.getText(), OMNode.ENTITY_REFERENCE_NODE);
      }
    }
    return dest;
  }
View Full Code Here

Examples of org.apache.axiom.om.OMText

        OMElement stmntElt = fac.createOMElement(
            AbstractDBMediatorFactory.STMNT_Q.getLocalPart(), synNS);

        OMElement sqlElt = fac.createOMElement(
            AbstractDBMediatorFactory.SQL_Q.getLocalPart(), synNS);
        OMText sqlText = fac.createOMText(statement.getRawStatement(), XMLStreamConstants.CDATA);
        sqlElt.addChild(sqlText);
        stmntElt.addChild(sqlElt);

        // serialize parameters of the statement
        for (Statement.Parameter param : statement.getParameters()) {
View Full Code Here

Examples of org.apache.axiom.om.OMText

        OMFactory doomFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory();
        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 = (OMXMLBuilderFactory.createStAXOMBuilder(this.factory, llomRoot
                .getXMLStreamReader())).getDocumentElement();
        newElement.build();
View Full Code Here

Examples of org.apache.axiom.om.OMText

        OMFactory doomFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory();
        OMFactory llomFactory = OMAbstractFactory.getOMFactory();
        String text = "This was a DOOM Text";

        OMElement doomRoot = doomFactory.createOMElement("root", null);
        OMText llomText = llomFactory.createOMText(text);
        OMComment comment = llomFactory.createOMComment(null, "comment");
        doomRoot.addChild(llomText);
        doomRoot.addChild(comment);

        OMElement newElement = (OMXMLBuilderFactory.createStAXOMBuilder(this.factory, doomRoot
View Full Code Here

Examples of org.apache.axiom.om.OMText

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", null);
        OMText text = factory.createOMText("test");
        element.addChild(text);
        assertSame(element, text.getParent());
        assertSame(text, element.getFirstOMChild());
    }
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.