Package org.dom4j

Examples of org.dom4j.Branch


    public Iterator getChildAxisIterator(Object contextNode)
    {
        Iterator result = null;
        if ( contextNode instanceof Branch )
        {
            Branch node = (Branch) contextNode;
            result = node.nodeIterator();
        }
        if (result != null) {
            return result;
        }
        return JaxenConstants.EMPTY_ITERATOR;
View Full Code Here


        this(new DocumentFactory(), new XmlFriendlyReplacer());
    }

    protected Object createNode(final String name) {
        final Element element = documentFactory.createElement(escapeXmlName(name));
        final Branch top = top();
        if (top != null) {
            top().add(element);
        }
        return element;
    }
View Full Code Here

     *
     * @return DOCUMENT ME!
     */
    protected List createChildList() {
        // add attributes and content as children?
        Branch branch = getXmlBranch();
        int size = branch.nodeCount();
        List childList = new ArrayList(size);

        for (int i = 0; i < size; i++) {
            Node node = branch.node(i);

            // ignore whitespace text nodes
            if (node instanceof CharacterData) {
                String text = node.getText();

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

        }

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

        Branch branch = currentElement;

        if (branch == null) {
            branch = getDocument();
        }

        Element element = branch.addElement(qName);

        // add all declared namespaces
        addDeclaredNamespaces(element);

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

    public Iterator getChildAxisIterator(Object contextNode)
    {
        Iterator result = null;
        if ( contextNode instanceof Branch )
        {
            Branch node = (Branch) contextNode;
            result = node.nodeIterator();
        }
        if (result != null) {
            return result;
        }
        return JaxenConstants.EMPTY_ITERATOR;
View Full Code Here

    public Iterator getChildAxisIterator(Object contextNode)
    {
        if ( contextNode instanceof Branch )
        {
            Branch node = (Branch) contextNode;
           
            return node.nodeIterator();
        }

        return null;
    }
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.