1
2
3
4
5
6
7
8 package org.dom4j.dom;
9
10 import org.dom4j.tree.DefaultDocumentType;
11
12 import org.w3c.dom.DOMException;
13 import org.w3c.dom.Document;
14 import org.w3c.dom.NamedNodeMap;
15 import org.w3c.dom.NodeList;
16
17 /***
18 * <p>
19 * <code>DOMDocumentType</code> implements a DocumentType node which supports
20 * the W3C DOM API.
21 * </p>
22 *
23 * @author <a href="mailto:james.strachan@metastuff.com">James Strachan </a>
24 * @version $Revision: 1.11 $
25 */
26 public class DOMDocumentType extends DefaultDocumentType implements
27 org.w3c.dom.DocumentType {
28 public DOMDocumentType() {
29 }
30
31 public DOMDocumentType(String elementName, String systemID) {
32 super(elementName, systemID);
33 }
34
35 public DOMDocumentType(String name, String publicID, String systemID) {
36 super(name, publicID, systemID);
37 }
38
39
40
41 public boolean supports(String feature, String version) {
42 return DOMNodeHelper.supports(this, feature, version);
43 }
44
45 public String getNamespaceURI() {
46 return DOMNodeHelper.getNamespaceURI(this);
47 }
48
49 public String getPrefix() {
50 return DOMNodeHelper.getPrefix(this);
51 }
52
53 public void setPrefix(String prefix) throws DOMException {
54 DOMNodeHelper.setPrefix(this, prefix);
55 }
56
57 public String getLocalName() {
58 return DOMNodeHelper.getLocalName(this);
59 }
60
61 public String getNodeName() {
62 return getName();
63 }
64
65
66
67
68 public String getNodeValue() throws DOMException {
69 return null;
70 }
71
72 public void setNodeValue(String nodeValue) throws DOMException {
73 }
74
75 public org.w3c.dom.Node getParentNode() {
76 return DOMNodeHelper.getParentNode(this);
77 }
78
79 public NodeList getChildNodes() {
80 return DOMNodeHelper.getChildNodes(this);
81 }
82
83 public org.w3c.dom.Node getFirstChild() {
84 return DOMNodeHelper.getFirstChild(this);
85 }
86
87 public org.w3c.dom.Node getLastChild() {
88 return DOMNodeHelper.getLastChild(this);
89 }
90
91 public org.w3c.dom.Node getPreviousSibling() {
92 return DOMNodeHelper.getPreviousSibling(this);
93 }
94
95 public org.w3c.dom.Node getNextSibling() {
96 return DOMNodeHelper.getNextSibling(this);
97 }
98
99 public NamedNodeMap getAttributes() {
100 return null;
101 }
102
103 public Document getOwnerDocument() {
104 return DOMNodeHelper.getOwnerDocument(this);
105 }
106
107 public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
108 org.w3c.dom.Node refChild) throws DOMException {
109 checkNewChildNode(newChild);
110
111 return DOMNodeHelper.insertBefore(this, newChild, refChild);
112 }
113
114 public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
115 org.w3c.dom.Node oldChild) throws DOMException {
116 checkNewChildNode(newChild);
117
118 return DOMNodeHelper.replaceChild(this, newChild, oldChild);
119 }
120
121 public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
122 throws DOMException {
123 return DOMNodeHelper.removeChild(this, oldChild);
124 }
125
126 public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
127 throws DOMException {
128 checkNewChildNode(newChild);
129
130 return DOMNodeHelper.appendChild(this, newChild);
131 }
132
133 private void checkNewChildNode(org.w3c.dom.Node newChild)
134 throws DOMException {
135 throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
136 "DocumentType nodes cannot have children");
137 }
138
139 public boolean hasChildNodes() {
140 return DOMNodeHelper.hasChildNodes(this);
141 }
142
143 public org.w3c.dom.Node cloneNode(boolean deep) {
144 return DOMNodeHelper.cloneNode(this, deep);
145 }
146
147 public void normalize() {
148 DOMNodeHelper.normalize(this);
149 }
150
151 public boolean isSupported(String feature, String version) {
152 return DOMNodeHelper.isSupported(this, feature, version);
153 }
154
155 public boolean hasAttributes() {
156 return DOMNodeHelper.hasAttributes(this);
157 }
158
159
160
161 public NamedNodeMap getEntities() {
162 return null;
163 }
164
165 public NamedNodeMap getNotations() {
166 return null;
167 }
168
169 public String getPublicId() {
170 return getPublicID();
171 }
172
173 public String getSystemId() {
174 return getSystemID();
175 }
176
177 public String getInternalSubset() {
178 return getElementName();
179 }
180 }
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217