001/*
002 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
003 * 
004 * This software is open source. 
005 * See the bottom of this file for the licence.
006 * 
007 * $Id: IllegalAddException.java,v 1.1 2001/01/19 05:58:39 jstrachan Exp $
008 */
009
010package org.dom4j;
011
012/** <p><code>IllegalAddException</code> is thrown when a node
013  * is added incorrectly to an <code>{@link Element}</code></p>
014  *
015  * @version $Revision: 1.1 $
016  */
017public class IllegalAddException extends IllegalArgumentException {
018
019    public IllegalAddException(String reason) {
020        super(reason);
021    }
022    
023    public IllegalAddException(Element parent,Node node,String reason) {
024        super( "The node \"" + node.toString() 
025            + "\" could not be added to the element \"" 
026            + parent.getQualifiedName() + "\" because: " + reason 
027        );
028    }
029    
030    public IllegalAddException(Branch parent,Node node,String reason) {
031        super( "The node \"" + node.toString() 
032            + "\" could not be added to the branch \"" 
033            + parent.getName() + "\" because: " + reason 
034        );
035    }
036}
037
038
039
040
041/*
042 * Redistribution and use of this software and associated documentation
043 * ("Software"), with or without modification, are permitted provided
044 * that the following conditions are met:
045 *
046 * 1. Redistributions of source code must retain copyright
047 *    statements and notices.  Redistributions must also contain a
048 *    copy of this document.
049 *
050 * 2. Redistributions in binary form must reproduce the
051 *    above copyright notice, this list of conditions and the
052 *    following disclaimer in the documentation and/or other
053 *    materials provided with the distribution.
054 *
055 * 3. The name "DOM4J" must not be used to endorse or promote
056 *    products derived from this Software without prior written
057 *    permission of MetaStuff, Ltd.  For written permission,
058 *    please contact dom4j-info@metastuff.com.
059 *
060 * 4. Products derived from this Software may not be called "DOM4J"
061 *    nor may "DOM4J" appear in their names without prior written
062 *    permission of MetaStuff, Ltd. DOM4J is a registered
063 *    trademark of MetaStuff, Ltd.
064 *
065 * 5. Due credit should be given to the DOM4J Project
066 *    (http://dom4j.org/).
067 *
068 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
069 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
070 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
071 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
072 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
073 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
074 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
075 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
076 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
077 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
078 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
079 * OF THE POSSIBILITY OF SUCH DAMAGE.
080 *
081 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
082 *
083 * $Id: IllegalAddException.java,v 1.1 2001/01/19 05:58:39 jstrachan Exp $
084 */