KickJava   Java API By Example, From Geeks To Geeks.

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


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: AbstractCharacterData.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.CharacterData;
13 import org.dom4j.Element;
14
15 /** <p><code>AbstractCharacterData</code> is an abstract base class for
16  * tree implementors to use for implementation inheritence.</p>
17  *
18  * @author <a HREF="mailto:jstrachan@apache.org">James Strachan</a>
19  * @version $Revision: 1.2 $
20  */

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

90
Popular Tags