Package org.dom4j

Examples of org.dom4j.Branch


        }

        QName qName = namespaceStack.getQName(namespaceURI, localName,
                qualifiedName);

        Branch branch = currentElement;

        if (branch == null) {
            branch = (org.dom4j.Document)getDocument();
        }
   
    Element element = new DOMElement(qName);
        branch.add(element);

        // add all declared namespaces
        addDeclaredNamespaces(element);

        // now lets add all attribute values
View Full Code Here


    public static org.w3c.dom.Node insertBefore(Node node,
            org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
            throws DOMException {
        if (node instanceof Branch) {
            Branch branch = (Branch) node;
            List list = branch.content();
            int index = list.indexOf(refChild);

            if (index < 0) {
                branch.add((Node) newChild);
            } else {
                list.add(index, newChild);
            }

            return newChild;
View Full Code Here

    public static org.w3c.dom.Node replaceChild(Node node,
            org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
            throws DOMException {
        if (node instanceof Branch) {
            Branch branch = (Branch) node;
            List list = branch.content();
            int index = list.indexOf(oldChild);

            if (index < 0) {
                throw new DOMException(DOMException.NOT_FOUND_ERR,
                        "Tried to replace a non existing child " + "for node: "
View Full Code Here

    }

    public static org.w3c.dom.Node removeChild(Node node,
            org.w3c.dom.Node oldChild) throws DOMException {
        if (node instanceof Branch) {
            Branch branch = (Branch) node;
            branch.remove((Node) oldChild);

            return oldChild;
        }

        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
View Full Code Here

    }

    public static org.w3c.dom.Node appendChild(Node node,
            org.w3c.dom.Node newChild) throws DOMException {
        if (node instanceof Branch) {
            Branch branch = (Branch) node;
            org.w3c.dom.Node previousParent = newChild.getParentNode();

            if (previousParent != null) {
                previousParent.removeChild(newChild);
            }

            branch.add((Node) newChild);

            return newChild;
        }

        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
View Full Code Here

/* 102 */     return this.children;
/*     */   }
/*     */
/*     */   protected List createChildList()
/*     */   {
/* 112 */     Branch branch = getXmlBranch();
/* 113 */     int size = branch.nodeCount();
/* 114 */     List childList = new ArrayList(size);
/*     */
/* 116 */     for (int i = 0; i < size; i++) {
/* 117 */       Node node = branch.node(i);
/*     */
/* 120 */       if ((node instanceof CharacterData)) {
/* 121 */         String text = node.getText();
/*     */
/* 123 */         if (text == null)
View Full Code Here

/*     */
/*     */   public static org.w3c.dom.Node insertBefore(org.dom4j.Node node, org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
/*     */     throws DOMException
/*     */   {
/* 130 */     if ((node instanceof Branch)) {
/* 131 */       Branch branch = (Branch)node;
/* 132 */       List list = branch.content();
/* 133 */       int index = list.indexOf(refChild);
/*     */
/* 135 */       if (index < 0)
/* 136 */         branch.add((org.dom4j.Node)newChild);
/*     */       else {
/* 138 */         list.add(index, newChild);
/*     */       }
/*     */
/* 141 */       return newChild;
View Full Code Here

/*     */
/*     */   public static org.w3c.dom.Node replaceChild(org.dom4j.Node node, org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
/*     */     throws DOMException
/*     */   {
/* 151 */     if ((node instanceof Branch)) {
/* 152 */       Branch branch = (Branch)node;
/* 153 */       List list = branch.content();
/* 154 */       int index = list.indexOf(oldChild);
/*     */
/* 156 */       if (index < 0) {
/* 157 */         throw new DOMException(8, "Tried to replace a non existing child for node: " + node);
/*     */       }
View Full Code Here

/*     */
/*     */   public static org.w3c.dom.Node removeChild(org.dom4j.Node node, org.w3c.dom.Node oldChild)
/*     */     throws DOMException
/*     */   {
/* 173 */     if ((node instanceof Branch)) {
/* 174 */       Branch branch = (Branch)node;
/* 175 */       branch.remove((org.dom4j.Node)oldChild);
/*     */
/* 177 */       return oldChild;
/*     */     }
/*     */
/* 180 */     throw new DOMException(3, "Children not allowed for this node: " + node);
View Full Code Here

/*     */
/*     */   public static org.w3c.dom.Node appendChild(org.dom4j.Node node, org.w3c.dom.Node newChild)
/*     */     throws DOMException
/*     */   {
/* 186 */     if ((node instanceof Branch)) {
/* 187 */       Branch branch = (Branch)node;
/* 188 */       org.w3c.dom.Node previousParent = newChild.getParentNode();
/*     */
/* 190 */       if (previousParent != null) {
/* 191 */         previousParent.removeChild(newChild);
/*     */       }
/*     */
/* 194 */       branch.add((org.dom4j.Node)newChild);
/*     */
/* 196 */       return newChild;
/*     */     }
/*     */
/* 199 */     throw new DOMException(3, "Children not allowed for this node: " + node);
View Full Code Here

TOP

Related Classes of org.dom4j.Branch

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.