KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > dom > GenericCDATASection


1 /*
2
3    Copyright 2000 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.dom;
19
20 import org.w3c.dom.CDATASection JavaDoc;
21 import org.w3c.dom.Node JavaDoc;
22 import org.w3c.dom.Text JavaDoc;
23
24 /**
25  * This class implements the {@link org.w3c.dom.CDATASection} interface.
26  *
27  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
28  * @version $Id: GenericCDATASection.java,v 1.6 2005/02/22 09:12:58 cam Exp $
29  */

30 public class GenericCDATASection extends AbstractText implements CDATASection JavaDoc {
31     /**
32      * Is this element immutable?
33      */

34     protected boolean readonly;
35
36     /**
37      * Creates a new CDATASection object.
38      */

39     protected GenericCDATASection() {
40     }
41
42     /**
43      * Creates a new CDATASection object.
44      */

45     public GenericCDATASection(String JavaDoc value, AbstractDocument owner) {
46     ownerDocument = owner;
47     setNodeValue(value);
48     }
49
50     /**
51      * <b>DOM</b>: Implements {@link org.w3c.dom.Node#getNodeName()}.
52      * @return "#cdata-section".
53      */

54     public String JavaDoc getNodeName() {
55     return "#cdata-section";
56     }
57
58     /**
59      * <b>DOM</b>: Implements {@link org.w3c.dom.Node#getNodeType()}.
60      * @return {@link org.w3c.dom.Node#CDATA_SECTION_NODE}
61      */

62     public short getNodeType() {
63     return CDATA_SECTION_NODE;
64     }
65
66     /**
67      * Tests whether this node is readonly.
68      */

69     public boolean isReadonly() {
70     return readonly;
71     }
72
73     /**
74      * Sets this node readonly attribute.
75      */

76     public void setReadonly(boolean v) {
77     readonly = v;
78     }
79
80     /**
81      * Creates a text node of the current type.
82      */

83     protected Text JavaDoc createTextNode(String JavaDoc text) {
84     return getOwnerDocument().createCDATASection(text);
85     }
86
87     /**
88      * Returns a new uninitialized instance of this object's class.
89      */

90     protected Node JavaDoc newNode() {
91         return new GenericCDATASection();
92     }
93 }
94
Popular Tags