KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Copyright 2000,2003 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.Node JavaDoc;
21
22 /**
23  * This class implements the {@link org.w3c.dom.Element} interface.
24  *
25  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
26  * @version $Id: GenericElementNS.java,v 1.5 2004/08/18 07:13:08 vhardy Exp $
27  */

28 public class GenericElementNS extends AbstractElementNS {
29     /**
30      * The node name.
31      */

32     protected String JavaDoc nodeName;
33
34     /**
35      * Is this element immutable?
36      */

37     protected boolean readonly;
38
39     /**
40      * Creates a new Element object.
41      */

42     protected GenericElementNS() {
43     }
44
45     /**
46      * Creates a new Element object.
47      * @param nsURI The element namespace URI.
48      * @param name The element qualified name.
49      * @param owner The owner document.
50      * @exception DOMException
51      * INVALID_CHARACTER_ERR: Raised if the specified qualified name
52      * contains an illegal character.
53      * <br> NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
54      * malformed, if the <code>qualifiedName</code> has a prefix and the
55      * <code>namespaceURI</code> is <code>null</code> or an empty string,
56      * or if the <code>qualifiedName</code> has a prefix that is "xml" and
57      * the <code>namespaceURI</code> is different from
58      * "http://www.w3.org/XML/1998/namespace" .
59      */

60     public GenericElementNS(String JavaDoc nsURI, String JavaDoc name,
61                             AbstractDocument owner) {
62     super(nsURI, name, owner);
63     nodeName = name;
64     }
65
66     /**
67      * Sets the name of this node.
68      */

69     public void setNodeName(String JavaDoc v) {
70     nodeName = v;
71     }
72
73     /**
74      * <b>DOM</b>: Implements {@link org.w3c.dom.Node#getNodeName()}.
75      * @return {@link #nodeName}
76      */

77     public String JavaDoc getNodeName() {
78     return nodeName;
79     }
80
81     // ExtendedNode ///////////////////////////////////////////////////
82

83     /**
84      * Tests whether this node is readonly.
85      */

86     public boolean isReadonly() {
87     return readonly;
88     }
89
90     /**
91      * Sets this node readonly attribute.
92      */

93     public void setReadonly(boolean v) {
94     readonly = v;
95     }
96
97     /**
98      * Exports this node to the given document.
99      */

100     protected Node JavaDoc export(Node JavaDoc n, AbstractDocument d) {
101     GenericElementNS ge = (GenericElementNS)super.export(n, d);
102     ge.nodeName = nodeName;
103     return n;
104     }
105
106     /**
107      * Deeply exports this node to the given document.
108      */

109     protected Node JavaDoc deepExport(Node JavaDoc n, AbstractDocument d) {
110     GenericElementNS ge = (GenericElementNS)super.deepExport(n, d);
111     ge.nodeName = nodeName;
112     return n;
113     }
114
115     /**
116      * Copy the fields of the current node into the given node.
117      * @param n a node of the type of this.
118      */

119     protected Node JavaDoc copyInto(Node JavaDoc n) {
120     GenericElementNS ge = (GenericElementNS)super.copyInto(n);
121     ge.nodeName = nodeName;
122     return n;
123     }
124
125     /**
126      * Deeply copy the fields of the current node into the given node.
127      * @param n a node of the type of this.
128      */

129     protected Node JavaDoc deepCopyInto(Node JavaDoc n) {
130     GenericElementNS ge = (GenericElementNS)super.deepCopyInto(n);
131     ge.nodeName = nodeName;
132     return n;
133     }
134
135     /**
136      * Returns a new uninitialized instance of this object's class.
137      */

138     protected Node JavaDoc newNode() {
139         return new GenericElementNS();
140     }
141 }
142
Popular Tags