Package org.dom4j

Examples of org.dom4j.IllegalAddException


     *
     * @throws IllegalAddException
     *             DOCUMENT ME!
     */
    protected void invalidNodeTypeAddException(Node node) {
        throw new IllegalAddException("Invalid node type. Cannot add node: "
                + node + " to this branch: " + this);
    }
View Full Code Here


    protected Node asNode(Object object) {
        if (object instanceof Node) {
            return (Node) object;
        } else {
            throw new IllegalAddException("This list must contain instances "
                    + "of Node. Invalid type: " + object);
        }
    }
View Full Code Here

    public void add(Attribute attribute) {
        if (attribute.getParent() != null) {
            String message = "The Attribute already has an existing parent \""
                    + attribute.getParent().getQualifiedName() + "\"";

            throw new IllegalAddException(this, attribute, message);
        }

        if (attribute.getValue() == null) {
            // try remove a previous attribute with the same
            // name since adding an attribute with a null value
View Full Code Here

            localName = name.substring(index + 1);

            namespace = getNamespaceForPrefix(prefix);

            if (namespace == null) {
                throw new IllegalAddException("No such namespace prefix: "
                        + prefix + " is in scope on: " + this
                        + " so cannot add element: " + name);
            }
        } else {
            namespace = getNamespaceForPrefix("");
View Full Code Here

        if (node.getParent() != null) {
            // XXX: could clone here
            String message = "The Node already has an existing parent of \""
                    + node.getParent().getQualifiedName() + "\"";

            throw new IllegalAddException(this, node, message);
        }

        addNewNode(node);
    }
View Full Code Here

        if (node.getParent() != null) {
            // XXX: could clone here
            String message = "The Node already has an existing parent of \""
                    + node.getParent().getQualifiedName() + "\"";

            throw new IllegalAddException(this, node, message);
        }

        addNewNode(index, node);
    }
View Full Code Here

    protected void checkAddElementAllowed(Element element) {
        Element root = getRootElement();

        if (root != null) {
            throw new IllegalAddException(this, element,
                    "Cannot add another element to this "
                            + "Document as it already has a root "
                            + "element of: " + root.getQualifiedName());
        }
    }
View Full Code Here

    protected Node asNode(Object object) {
        if (object instanceof Node) {
            return (Node) object;
        } else {
            throw new IllegalAddException(
                    "This list must contain instances of "
                            + "Node. Invalid type: " + object);
        }
    }
View Full Code Here

                    if (node instanceof Element) {
                        if (rootElement == null) {
                            rootElement = (Element) node;
                        } else {
                            throw new IllegalAddException(
                                    "A document may only "
                                            + "contain one root " + "element: "
                                            + content);
                        }
                    }
View Full Code Here

            if ((document != null) && (document != this)) {
                // XXX: could clone here
                String message = "The Node already has an existing document: "
                        + document;
                throw new IllegalAddException(this, node, message);
            }

            contentList().add(node);
            childAdded(node);
        }
View Full Code Here

TOP

Related Classes of org.dom4j.IllegalAddException

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.