1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| package org.dom4j.dom; |
11 |
| |
12 |
| import org.dom4j.Element; |
13 |
| import org.dom4j.tree.DefaultEntity; |
14 |
| import org.w3c.dom.DOMException; |
15 |
| import org.w3c.dom.Document; |
16 |
| import org.w3c.dom.NamedNodeMap; |
17 |
| import org.w3c.dom.NodeList; |
18 |
| |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| public class DOMEntityReference extends DefaultEntity implements org.w3c.dom.EntityReference { |
26 |
| |
27 |
0
| public DOMEntityReference(String name) {
|
28 |
0
| super( name );
|
29 |
| } |
30 |
| |
31 |
0
| public DOMEntityReference(String name, String text) {
|
32 |
0
| super( name, text );
|
33 |
| } |
34 |
| |
35 |
0
| public DOMEntityReference(Element parent, String name, String text) {
|
36 |
0
| super( parent, name, text );
|
37 |
| } |
38 |
| |
39 |
| |
40 |
| |
41 |
| |
42 |
0
| public boolean supports(String feature, String version) {
|
43 |
0
| return DOMNodeHelper.supports(this, feature, version);
|
44 |
| } |
45 |
| |
46 |
0
| public String getNamespaceURI() {
|
47 |
0
| return DOMNodeHelper.getNamespaceURI(this);
|
48 |
| } |
49 |
| |
50 |
0
| public String getPrefix() {
|
51 |
0
| return DOMNodeHelper.getPrefix(this);
|
52 |
| } |
53 |
| |
54 |
0
| public void setPrefix(String prefix) throws DOMException {
|
55 |
0
| DOMNodeHelper.setPrefix(this, prefix);
|
56 |
| } |
57 |
| |
58 |
0
| public String getLocalName() {
|
59 |
0
| return DOMNodeHelper.getLocalName(this);
|
60 |
| } |
61 |
| |
62 |
0
| public String getNodeName() {
|
63 |
0
| return getName();
|
64 |
| } |
65 |
| |
66 |
| |
67 |
| |
68 |
| |
69 |
| |
70 |
| |
71 |
| |
72 |
0
| public String getNodeValue() throws DOMException {
|
73 |
0
| return null;
|
74 |
| } |
75 |
| |
76 |
0
| public void setNodeValue(String nodeValue) throws DOMException {
|
77 |
| } |
78 |
| |
79 |
| |
80 |
0
| public org.w3c.dom.Node getParentNode() {
|
81 |
0
| return DOMNodeHelper.getParentNode(this);
|
82 |
| } |
83 |
| |
84 |
0
| public NodeList getChildNodes() {
|
85 |
0
| return DOMNodeHelper.getChildNodes(this);
|
86 |
| } |
87 |
| |
88 |
0
| public org.w3c.dom.Node getFirstChild() {
|
89 |
0
| return DOMNodeHelper.getFirstChild(this);
|
90 |
| } |
91 |
| |
92 |
0
| public org.w3c.dom.Node getLastChild() {
|
93 |
0
| return DOMNodeHelper.getLastChild(this);
|
94 |
| } |
95 |
| |
96 |
0
| public org.w3c.dom.Node getPreviousSibling() {
|
97 |
0
| return DOMNodeHelper.getPreviousSibling(this);
|
98 |
| } |
99 |
| |
100 |
0
| public org.w3c.dom.Node getNextSibling() {
|
101 |
0
| return DOMNodeHelper.getNextSibling(this);
|
102 |
| } |
103 |
| |
104 |
0
| public NamedNodeMap getAttributes() {
|
105 |
0
| return null;
|
106 |
| } |
107 |
| |
108 |
0
| public Document getOwnerDocument() {
|
109 |
0
| return DOMNodeHelper.getOwnerDocument(this);
|
110 |
| } |
111 |
| |
112 |
0
| public org.w3c.dom.Node insertBefore(
|
113 |
| org.w3c.dom.Node newChild, |
114 |
| org.w3c.dom.Node refChild |
115 |
| ) throws DOMException { |
116 |
0
| checkNewChildNode(newChild);
|
117 |
0
| return DOMNodeHelper.insertBefore(this, newChild, refChild);
|
118 |
| } |
119 |
| |
120 |
0
| public org.w3c.dom.Node replaceChild(
|
121 |
| org.w3c.dom.Node newChild, |
122 |
| org.w3c.dom.Node oldChild |
123 |
| ) throws DOMException { |
124 |
0
| checkNewChildNode(newChild);
|
125 |
0
| return DOMNodeHelper.replaceChild(this, newChild, oldChild);
|
126 |
| } |
127 |
| |
128 |
0
| public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws DOMException {
|
129 |
0
| return DOMNodeHelper.removeChild(this, oldChild);
|
130 |
| } |
131 |
| |
132 |
0
| public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws DOMException {
|
133 |
0
| checkNewChildNode(newChild);
|
134 |
0
| return DOMNodeHelper.appendChild(this, newChild);
|
135 |
| } |
136 |
| |
137 |
0
| private void checkNewChildNode(org.w3c.dom.Node newChild) throws DOMException {
|
138 |
0
| final int nodeType = newChild.getNodeType();
|
139 |
0
| if (!(nodeType == org.w3c.dom.Node.ELEMENT_NODE ||
|
140 |
| nodeType == org.w3c.dom.Node.TEXT_NODE || |
141 |
| nodeType == org.w3c.dom.Node.COMMENT_NODE || |
142 |
| nodeType == org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE || |
143 |
| nodeType == org.w3c.dom.Node.CDATA_SECTION_NODE || |
144 |
| nodeType == org.w3c.dom.Node.ENTITY_REFERENCE_NODE)) { |
145 |
0
| throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
|
146 |
| "Specified node cannot be a child of an entity reference"); |
147 |
| } |
148 |
| } |
149 |
| |
150 |
| |
151 |
0
| public boolean hasChildNodes() {
|
152 |
0
| return DOMNodeHelper.hasChildNodes(this);
|
153 |
| } |
154 |
| |
155 |
0
| public org.w3c.dom.Node cloneNode(boolean deep) {
|
156 |
0
| return DOMNodeHelper.cloneNode(this, deep);
|
157 |
| } |
158 |
| |
159 |
0
| public void normalize() {
|
160 |
0
| DOMNodeHelper.normalize(this);
|
161 |
| } |
162 |
| |
163 |
0
| public boolean isSupported(String feature, String version) {
|
164 |
0
| return DOMNodeHelper.isSupported(this, feature, version);
|
165 |
| } |
166 |
| |
167 |
0
| public boolean hasAttributes() {
|
168 |
0
| return DOMNodeHelper.hasAttributes(this);
|
169 |
| } |
170 |
| } |
171 |
| |
172 |
| |
173 |
| |
174 |
| |
175 |
| |
176 |
| |
177 |
| |
178 |
| |
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 |
| |
218 |
| |