Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMText


    }

    protected void runTest() throws Throwable {
        SOAPFaultDetail soapFaultDetail = getTestMessage(MESSAGE).getBody().getFault().getDetail();
        Iterator iterator = soapFaultDetail.getAllDetailEntries();
        OMText textEntry = (OMText) iterator.next();
        assertNotNull(
                "SOAP Fault Detail Test With Parser : - getAllDetailEntries method returns empty iterator",
                textEntry);
        assertEquals(
                "SOAP Fault Detail Test With Parser : - text value mismatch",
                "Details of error", textEntry.getText().trim());
        OMElement detailEntry1 = (OMElement) iterator.next();
        assertNotNull(
                "SOAP Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator without detail entries",
                detailEntry1);
        assertEquals(
View Full Code Here


           
            public boolean isDestructiveWrite() {
                return false;
            }
        });
        OMText child = (OMText)element.getFirstOMChild();
        assertTrue(child.isBinary());
        assertSame(dh, child.getDataHandler());
    }
View Full Code Here

                    dataHandlerObject = dataHandlerReader.getDataHandler();
                } catch (XMLStreamException ex) {
                    throw new OMException(ex);
                }
            }
            OMText text = omfactory.createOMText(target, dataHandlerObject, dataHandlerReader.isOptimized(), true);
            String contentID = dataHandlerReader.getContentID();
            if (contentID != null) {
                text.setContentID(contentID);
            }
            return text;
        } else {
            // Some parsers (like Woodstox) parse text nodes lazily and may throw a
            // RuntimeException in getText()
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMNamespace testNamespace = factory.createOMNamespace("http://test.ws.org", "test");
        OMElement documentElement = factory.createOMElement("Employees", testNamespace);
        documentElement.declareNamespace(testNamespace);
        OMText txt = factory.createOMText(documentElement, " ");
        OMElement e = factory.createOMElement("Employee", testNamespace, documentElement);
        e.setText("Apache Developer");

        Iterator childrenIter = documentElement.getChildrenWithName(new QName("http://test.ws.org", "Employee", "test"));
        OMElement employee = (OMElement) childrenIter.next(); // should walk past OMText
View Full Code Here

                        .getDocumentElement();
                newElement.build();
                return newElement;
            }
            case (OMNode.TEXT_NODE): {
                OMText importedText = (OMText) child;
                OMText newText;
                if (importedText.isBinary()) {
                    boolean isOptimize = importedText.isOptimized();
                    newText = createOMText(importedText
                            .getDataHandler(), isOptimize);
                } else if (importedText.isCharacters()) {
View Full Code Here

    DataSource dataSource = new FileDataSource(file);
    assertNotNull(dataSource);
    DataHandler dataHandler = new DataHandler(dataSource);

    OMText textData = fac.createOMText(dataHandler, true);
    attachElem.addChild(textData);
    pingElem.addChild(attachElem);

    return pingElem;
  }
View Full Code Here

    OMElement payload = body.getFirstElement();
    OMElement attachmentElem = payload.getFirstChildWithName(new QName(applicationNamespaceName, Attachment));
    if (attachmentElem == null)
      throw new AxisFault("'Attachment' element is not present as a child of the 'Ping' element");

    OMText binaryElem = (OMText) attachmentElem.getFirstOMChild();

    binaryElem.setOptimize(true);
    DataHandler dataHandler = (DataHandler) binaryElem.getDataHandler();

    try {
      File destinationFile = new File(DESTINATION_IMAGE_FILE);
      if (destinationFile.exists())
        destinationFile.delete();
View Full Code Here

                newElement.build();
                return (OMNode) this.ownerNode.importNode((Element) newElement,
                                                          true);
            }
            case (OMNode.TEXT_NODE): {
                OMText importedText = (OMText) child;
                OMText newText;
                if (importedText.isBinary()) {
                    boolean isOptimize = importedText.isOptimized();
                    newText = this.factory.createOMText(importedText
                            .getDataHandler(), isOptimize);
                } else if (importedText.isCharacters()) {
View Full Code Here

        OMNode child = this.getFirstOMChild();

        while (child != null) {
            final int type = child.getType();
            if (type == OMNode.TEXT_NODE || type == OMNode.CDATA_SECTION_NODE) {
                OMText textNode = (OMText) child;
                String textValue = textNode.getText();
                if (textValue != null && textValue.length() != 0) {
                    if (childText == null) {
                        // This is the first non empty text node. Just save the string.
                        childText = textValue;
                    } else {
View Full Code Here

        StringBuffer buffer = null;
        OMNode child = this.getFirstOMChild();

        while (child != null) {
            if (child.getType() == OMNode.TEXT_NODE) {
                OMText textNode = (OMText) child;
                String textValue = textNode.getText();
                if (textValue != null && textValue.length() != 0) {
                    if (childText == null) {
                        // This is the first non empty text node. Just save the string.
                        childText = textValue.trim();
                    } else {
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.