KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > dom4j > o3impl > AbstractCDATA


1 /*
2  * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
3  *
4  * This software is open source.
5  * See the bottom of this file for the licence.
6  *
7  * $Id: AbstractCDATA.java,v 1.2 2003/06/10 16:18:35 per_nyfelt Exp $
8  */

9
10 package org.ozoneDB.xml.dom4j.o3impl;
11
12 import org.dom4j.CDATA;
13 import org.dom4j.Visitor;
14
15 import java.io.IOException JavaDoc;
16 import java.io.Writer JavaDoc;
17
18 /** <p><code>AbstractCDATA</code> is an abstract base class for
19  * tree implementors to use for implementation inheritence.</p>
20  *
21  * @author <a HREF="mailto:james.strachan@metastuff.com">James Strachan</a>
22  * @version $Revision: 1.2 $
23  */

24 public abstract class AbstractCDATA extends AbstractCharacterData implements CDATA {
25
26     public AbstractCDATA() {
27     }
28
29     public short getNodeType() {
30         return CDATA_SECTION_NODE;
31     }
32
33     public String JavaDoc toString() {
34         return super.toString() + " [CDATA: \"" + getText() + "\"]";
35     }
36
37     public String JavaDoc asXML() {
38         return "<![CDATA[" + getText() + "]]>";
39     }
40
41     public void write(Writer JavaDoc writer) throws IOException JavaDoc {
42         writer.write("<![CDATA[");
43         writer.write(getText());
44         writer.write("]]>");
45     }
46
47     public void accept(Visitor visitor) {
48         visitor.visit(this);
49     }
50 }
51
52
53 /*
54  * Redistribution and use of this software and associated documentation
55  * ("Software"), with or without modification, are permitted provided
56  * that the following conditions are met:
57  *
58  * 1. Redistributions of source code must retain copyright
59  * statements and notices. Redistributions must also contain a
60  * copy of this document.
61  *
62  * 2. Redistributions in binary form must reproduce the
63  * above copyright notice, this list of conditions and the
64  * following disclaimer in the documentation and/or other
65  * materials provided with the distribution.
66  *
67  * 3. The name "DOM4J" must not be used to endorse or promote
68  * products derived from this Software without prior written
69  * permission of MetaStuff, Ltd. For written permission,
70  * please contact dom4j-info@metastuff.com.
71  *
72  * 4. Products derived from this Software may not be called "DOM4J"
73  * nor may "DOM4J" appear in their names without prior written
74  * permission of MetaStuff, Ltd. DOM4J is a registered
75  * trademark of MetaStuff, Ltd.
76  *
77  * 5. Due credit should be given to the DOM4J Project
78  * (http://dom4j.org/).
79  *
80  * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
81  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
82  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
83  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
84  * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
85  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
86  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
87  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
88  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
89  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
90  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
91  * OF THE POSSIBILITY OF SUCH DAMAGE.
92  *
93  * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
94  *
95  * $Id: AbstractCDATA.java,v 1.2 2003/06/10 16:18:35 per_nyfelt Exp $
96  */

97
Popular Tags