KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > tree > TextImpl


1 package com.icl.saxon.tree;
2 import com.icl.saxon.om.NodeInfo;
3 import com.icl.saxon.om.DocumentInfo;
4 import com.icl.saxon.output.Outputter;
5
6 import org.w3c.dom.Text JavaDoc;
7 import org.w3c.dom.DOMException JavaDoc;
8 import javax.xml.transform.TransformerException JavaDoc;
9
10 /**
11   * A node in the XML parse tree representing character content<P>
12   * @author <A HREF="mailto:mhkay@iclway.co.uk>Michael H. Kay</A>
13   */

14
15 final class TextImpl extends NodeImpl implements Text JavaDoc {
16
17     private NodeInfo parent;
18     private String JavaDoc content;
19     
20     public TextImpl(ParentNodeImpl parent, String JavaDoc content) {
21         this.parent = parent;
22         this.content = content;
23     }
24
25     /**
26     * Get the root of the document.
27     */

28
29     public DocumentInfo getDocumentRoot() {
30         return parent.getDocumentRoot();
31     }
32
33     /**
34     * Return the character value of the node.
35     * @return the string value of the node
36     */

37
38     public String JavaDoc getStringValue() {
39         return content;
40     }
41
42     /**
43     * Return the type of node.
44     * @return Node.TEXT
45     */

46
47     public final short getNodeType() {
48         return TEXT;
49     }
50    
51     /**
52     * Copy this node to a given outputter
53     */

54
55     public void copy(Outputter out) throws TransformerException JavaDoc {
56         out.writeContent(content);
57     }
58
59     /**
60     * Copy the string-value of this node to a given outputter
61     */

62
63     public void copyStringValue(Outputter out) throws TransformerException JavaDoc {
64         out.writeContent(content);
65     }
66
67     /**
68     * Delete string content of this and all subsequent nodes. For use when deleting
69     * an element in preview mode
70     */

71
72     public void truncateToStart() {
73        //getCharacterBuffer().setLength(start);
74
}
75
76 }
77
78 //
79
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
80
// you may not use this file except in compliance with the License. You may obtain a copy of the
81
// License at http://www.mozilla.org/MPL/
82
//
83
// Software distributed under the License is distributed on an "AS IS" basis,
84
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
85
// See the License for the specific language governing rights and limitations under the License.
86
//
87
// The Original Code is: all this file.
88
//
89
// The Initial Developer of the Original Code is
90
// Michael Kay of International Computers Limited (mhkay@iclway.co.uk).
91
//
92
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
93
//
94
// Contributor(s): none.
95
//
Popular Tags