Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMText


    public int echoInt(int in) {
        return in;
    }

    public OMElement echoMTOMtoBase64(OMElement omEle) {
        OMText omText = (OMText) omEle.getFirstOMChild();
        omText.setOptimize(false);
        return omEle;
    }
View Full Code Here


public class MTOMService {
    public OMElement mtomSample(OMElement element) throws Exception {
     
        OMElement imageEle = element.getFirstElement();
        OMElement imageName = (OMElement) imageEle.getNextOMSibling();
        OMText binaryNode = (OMText) imageEle.getFirstOMChild();
        String fileName = imageName.getText();
        //Extracting the data and saving
        DataHandler actualDH;
        actualDH = (DataHandler)binaryNode.getDataHandler();
        Image actualObject = new ImageIO().loadImage(actualDH.getDataSource()
                .getInputStream());
        FileOutputStream imageOutStream = new FileOutputStream(fileName);
        new ImageIO().saveImage("image/jpeg", actualObject, imageOutStream);
        //setting response
View Full Code Here

        Iterator iter = ((OMElement) omNode).getChildren();
        NodeListImpl list = new NodeListImpl();
        while (iter.hasNext()) {
          Object omChild =  iter.next();
          if(omChild instanceof OMText){
            OMText omTextChild = (OMText)omChild;
            TextImpl textChild = new TextImpl(omTextChild);
            list.addNode(textChild);
          }else{
            OMNode omNodeChild = (OMNode)omChild;
            Node nodeChild = new NodeImpl(omNodeChild);
View Full Code Here

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


            OMText node;
            String contentID = null;
            String contentIDName = null;
            if (lastNode == null) {
                // Decide whether to ckeck the level >3 or not
                throw new OMException(
View Full Code Here

    public void testCreateText() {
        OMElement omElement = omFactory.createOMElement("chinthaka",
                namespace);
        String text = "sampleText";
        OMText omText = omFactory.createText(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

    String prefix = "axis2";
    String tempText = "The quick brown fox jumps over the lazy dog";
    String textToAppend = " followed by another";
   
    OMElement elem = factory.createOMElement(localName,namespace,prefix);
    OMText textNode = factory.createText(elem,tempText);
   
    ((Text)textNode).appendData(textToAppend);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
      elem.serialize(baos);
View Full Code Here

//        System.out.println(data.getLocalName() + " : "
//                + data.getNamespace().getName());
        Iterator childIt = data.getChildren();
        //while (childIt.hasNext()) {
        OMElement child = (OMElement) childIt.next();
        OMText blob = (OMText) child.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.
         */
        byte[] expectedObject = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2,
                                           -1, 98};
        DataHandler actualDH;
        actualDH = (DataHandler)blob.getDataHandler();
        //ByteArrayInputStream object = (ByteArrayInputStream) actualDH
        //.getContent();
        //byte[] actualObject= null;
        //  object.read(actualObject,0,10);

View Full Code Here

    String namespace = "http://ws.apache.org/axis2/ns";
    String prefix = "axis2";
    String tempText = "The quick brown fox jumps over the lazy dog";

    OMElement elem = factory.createOMElement(localName, namespace, prefix);
    OMText textNode = factory.createText(elem, tempText);

    assertEquals("Text value mismatch", tempText, textNode.getText());
  }
View Full Code Here

    String prefix = "axis2";
    String tempText = "The quick brown fox jumps over the lazy dog";
    String textToAppend = " followed by another fox";

    OMElement elem = factory.createOMElement(localName, namespace, prefix);
    OMText textNode = factory.createText(elem, tempText);

    ((Text) textNode).appendData(textToAppend);

    assertEquals("Text value mismatch", tempText + textToAppend, textNode
        .getText());
  }
View Full Code Here

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

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

View Full Code Here

TOP

Related Classes of org.apache.axis2.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.