Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMNode


    /**
     * dom Node method
     */
    public org.w3c.dom.Node getNextSibling() {

        OMNode sibling = omNode.getNextOMSibling();
        return new NodeImpl(sibling);
    }
View Full Code Here


    /**
     * dom Node method
     */
    public org.w3c.dom.Node getPreviousSibling() {

        OMNode prevSibling = omNode.getPreviousOMSibling();
        return new NodeImpl(prevSibling);
    }
View Full Code Here

          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);
            list.addNode(nodeChild);
          }
           
        }
View Full Code Here

     * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node)
     */
    public org.w3c.dom.Node appendChild(org.w3c.dom.Node node)
            throws DOMException {

        OMNode child = Dom2OmUtils.toOM(node);
        if (omNode.getType() == OMNode.ELEMENT_NODE)
            ((OMElement) omNode).addChild(child);
        return null;
    }
View Full Code Here

     * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node)
     */
    public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
            throws DOMException {
        //Check if equals method has been removed from OMNode
        OMNode child = Dom2OmUtils.toOM(oldChild);
        if (omNode.getType() == OMNode.ELEMENT_NODE) {
            Iterator iter = ((OMElement) omNode).getChildren();
            while (iter.hasNext()) {
                Object nextChild = iter.next();
                if (nextChild instanceof OMNode && nextChild.equals(child)) {
View Full Code Here

    /**
     * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
     */
    public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                         org.w3c.dom.Node refChild) throws DOMException {
        OMNode newOmChild = Dom2OmUtils.toOM(newChild);
        OMNode refOmChild = Dom2OmUtils.toOM(refChild);
        if (omNode.getType() == OMNode.ELEMENT_NODE) {
            Iterator iter = ((OMElement) omNode).getChildren();
            while (iter.hasNext()) {
                Object nextChild = iter.next();
                if (nextChild instanceof OMNode &&
View Full Code Here

    private static boolean isOptimised(OMElement element) {
        Iterator childrenIter = element.getChildren();
        boolean isOptimized = false;
        while (childrenIter.hasNext() && !isOptimized) {
            OMNode node = (OMNode) childrenIter.next();
            if (OMNode.TEXT_NODE == node.getType()
                && ((OMText) node).isOptimized()) {
                isOptimized = true;
            } else if (OMNode.ELEMENT_NODE == node.getType()) {
                isOptimized = isOptimised((OMElement) node);
            }
        }
        return isOptimized;
    }
View Full Code Here

  /**
   * Returns the first Element node
   * @see org.apache.axis2.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

   * select all the text children and concat them to a single string
   * @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();
    }

    return childText;
  }
View Full Code Here

      String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null);
            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

TOP

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