KickJava   Java API By Example, From Geeks To Geeks.

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


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: AbstractText.java,v 1.2 2003/06/10 16:18:36 per_nyfelt Exp $
8  */

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

95
Popular Tags