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