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: DefaultCDATA.java,v 1.6 2001/06/20 18:59:23 jstrachan Exp $
008 */
009
010package org.dom4j.tree;
011
012import org.dom4j.Element;
013
014/** <p><code>DefaultCDATA</code> is the default CDATA implementation.
015  * It is a doubly linked node which supports the parent relationship 
016  * and can be modified in place.</p>
017  *
018  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
019  * @version $Revision: 1.6 $
020  */
021public class DefaultCDATA extends FlyweightCDATA {
022
023    /** The parent of this node */
024    private Element parent;
025
026    /** @param text is the CDATA text
027      */
028    public DefaultCDATA(String text) {
029        super(text);
030    }
031
032    /** @param parent is the parent element
033      * @param text is the CDATA text
034      */
035    public DefaultCDATA(Element parent,String text) {
036        super(text);
037        this.parent = parent;
038    }
039
040    public void setText(String text) {
041        this.text = text;
042    }
043    
044    public Element getParent() {
045        return parent;
046    }
047
048    public void setParent(Element parent) {
049        this.parent = parent;
050    }
051    
052    public boolean supportsParent() {
053        return true;
054    }
055
056    public boolean isReadOnly() {
057        return false;
058    }
059}
060
061
062
063
064/*
065 * Redistribution and use of this software and associated documentation
066 * ("Software"), with or without modification, are permitted provided
067 * that the following conditions are met:
068 *
069 * 1. Redistributions of source code must retain copyright
070 *    statements and notices.  Redistributions must also contain a
071 *    copy of this document.
072 *
073 * 2. Redistributions in binary form must reproduce the
074 *    above copyright notice, this list of conditions and the
075 *    following disclaimer in the documentation and/or other
076 *    materials provided with the distribution.
077 *
078 * 3. The name "DOM4J" must not be used to endorse or promote
079 *    products derived from this Software without prior written
080 *    permission of MetaStuff, Ltd.  For written permission,
081 *    please contact dom4j-info@metastuff.com.
082 *
083 * 4. Products derived from this Software may not be called "DOM4J"
084 *    nor may "DOM4J" appear in their names without prior written
085 *    permission of MetaStuff, Ltd. DOM4J is a registered
086 *    trademark of MetaStuff, Ltd.
087 *
088 * 5. Due credit should be given to the DOM4J Project
089 *    (http://dom4j.org/).
090 *
091 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
092 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
093 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
094 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
095 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
096 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
097 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
098 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
099 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
100 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
101 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
102 * OF THE POSSIBILITY OF SUCH DAMAGE.
103 *
104 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
105 *
106 * $Id: DefaultCDATA.java,v 1.6 2001/06/20 18:59:23 jstrachan Exp $
107 */