Package org.apache.ws.commons.om

Examples of org.apache.ws.commons.om.OMNode


     *
     * @return Returns OMNode.
     * @throws OMException
     */
    protected OMNode createOMText(int textType) throws OMException {
        OMNode node = null;
        if (lastNode == null) {
            return null;
        } else if (!lastNode.isComplete()) {
            node = omfactory.createText((OMElement) lastNode, parser.getText(), textType);
        } else if (!(lastNode.getParent() instanceof OMDocument)) {
View Full Code Here


  }

  protected OMElement getChildWithName(String childName) {
    Iterator childrenIter = getChildren();
    while (childrenIter.hasNext()) {
      OMNode node = (OMNode) childrenIter.next();
      if (node.getType() == OMNode.ELEMENT_NODE
          && childName.equals(((OMElement) node).getLocalName())) {
        return (OMElement) node;
      }
    }
    return null;
View Full Code Here

     * Returns the first Element node.
     *
     * @see org.apache.ws.commons.om.OMElement#getFirstElement()
     */
    public OMElement getFirstElement() {
        OMNode node = getFirstOMChild();
        while (node != null) {
            if (node.getType() == Node.ELEMENT_NODE) {
                return (OMElement) node;
            } else {
                node = node.getNextOMSibling();
            }
        }
        return null;
    }
View Full Code Here

     *
     * @see org.apache.ws.commons.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();
        }

        return childText;
    }
View Full Code Here

            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                    msg);
        }

        // if we already have other text nodes remove them
        OMNode child = this.getFirstOMChild();
        while (child != null) {
            if (child.getType() == OMNode.TEXT_NODE) {
                child.detach();
            }
            child = child.getNextOMSibling();
        }

        TextImpl textNode = (TextImpl) ((DocumentImpl) this.ownerNode)
                .createTextNode(text);
        this.addChild(textNode);
View Full Code Here

    OMElement element = getFirstElement();
    if (element != null) {
      if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
        return (SOAPBody) element;
      } else { // if not second element SHOULD be the body
        OMNode node = element.getNextOMSibling();
        while (node != null && node.getType() != OMNode.ELEMENT_NODE) {
          node = node.getNextOMSibling();
        }
        element = (OMElement) node;

        if (node != null
            && SOAPConstants.BODY_LOCAL_NAME.equals(element
View Full Code Here

        return result.iterator();
    }

    public ArrayList getHeaderBlocksWithNSURI(String nsURI) {
        ArrayList headers = null;
        OMNode node = null;
        OMElement header = this.getFirstElement();

        if (header != null) {
            headers = new ArrayList();
        }

        node = header;

        while (node != null) {
            if (node.getType() == OMNode.ELEMENT_NODE) {
                header = (OMElement) node;
                if (nsURI.equals(header.getNamespace().getName())) {
                    headers.add(header);
                }
            }
            node = node.getNextOMSibling();

        }
        return headers;

    }
View Full Code Here

                backtracked = true;
            } else {
                next = null;
            }
        } else {
            OMNode nextSibling = ((ChildNode) next).nextSibling;
            OMContainer parent = next.getParent();
            if (nextSibling != null) {
                next = nextSibling;
            } else if ((parent != null) && parent.isComplete()) {
                next = (NodeImpl) parent;
View Full Code Here

            }
        }
        Iterator it = omEle.getChildren();
        if (it != null) {
            while (it.hasNext()) {
                OMNode ele = (OMNode) it.next();
                TestCase.assertNotNull("once the has next is not null, the " +
                        "element should not be null", ele);
                if (ele instanceof OMElement) {
                    walkThrough((OMElement) ele);
                }
View Full Code Here

            NodeList list = ele.getChildNodes();
            for (int i = 0; i < list.getLength(); i++) {
                Node node = list.item(i);
                if (node.getNodeType() == Node.ELEMENT_NODE) {
                    TestCase.assertTrue(it.hasNext());
                    OMNode tempOmNode = (OMNode) it.next();
                    while (tempOmNode.getType() != OMNode.ELEMENT_NODE) {
                        TestCase.assertTrue(it.hasNext());
                        tempOmNode = (OMNode) it.next();
                    }
                    compare((Element) node, (OMElement) tempOmNode);
                }
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.om.OMNode

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.