nokogiri 1.11.1-java → 1.11.2-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE-DEPENDENCIES.md +12 -12
  3. data/LICENSE.md +1 -1
  4. data/README.md +20 -15
  5. data/ext/java/nokogiri/EncodingHandler.java +78 -59
  6. data/ext/java/nokogiri/HtmlDocument.java +137 -114
  7. data/ext/java/nokogiri/HtmlElementDescription.java +104 -87
  8. data/ext/java/nokogiri/HtmlEntityLookup.java +31 -26
  9. data/ext/java/nokogiri/HtmlSaxParserContext.java +220 -192
  10. data/ext/java/nokogiri/HtmlSaxPushParser.java +164 -139
  11. data/ext/java/nokogiri/NokogiriService.java +597 -526
  12. data/ext/java/nokogiri/XmlAttr.java +120 -96
  13. data/ext/java/nokogiri/XmlAttributeDecl.java +97 -76
  14. data/ext/java/nokogiri/XmlCdata.java +35 -26
  15. data/ext/java/nokogiri/XmlComment.java +48 -37
  16. data/ext/java/nokogiri/XmlDocument.java +642 -540
  17. data/ext/java/nokogiri/XmlDocumentFragment.java +127 -107
  18. data/ext/java/nokogiri/XmlDtd.java +450 -384
  19. data/ext/java/nokogiri/XmlElement.java +25 -18
  20. data/ext/java/nokogiri/XmlElementContent.java +345 -286
  21. data/ext/java/nokogiri/XmlElementDecl.java +126 -95
  22. data/ext/java/nokogiri/XmlEntityDecl.java +121 -97
  23. data/ext/java/nokogiri/XmlEntityReference.java +51 -42
  24. data/ext/java/nokogiri/XmlNamespace.java +177 -145
  25. data/ext/java/nokogiri/XmlNode.java +1843 -1588
  26. data/ext/java/nokogiri/XmlNodeSet.java +361 -299
  27. data/ext/java/nokogiri/XmlProcessingInstruction.java +49 -39
  28. data/ext/java/nokogiri/XmlReader.java +513 -418
  29. data/ext/java/nokogiri/XmlRelaxng.java +91 -78
  30. data/ext/java/nokogiri/XmlSaxParserContext.java +330 -285
  31. data/ext/java/nokogiri/XmlSaxPushParser.java +229 -190
  32. data/ext/java/nokogiri/XmlSchema.java +328 -263
  33. data/ext/java/nokogiri/XmlSyntaxError.java +113 -83
  34. data/ext/java/nokogiri/XmlText.java +57 -46
  35. data/ext/java/nokogiri/XmlXpathContext.java +240 -206
  36. data/ext/java/nokogiri/XsltStylesheet.java +282 -239
  37. data/ext/java/nokogiri/internals/ClosedStreamException.java +5 -2
  38. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +199 -168
  39. data/ext/java/nokogiri/internals/IgnoreSchemaErrorsErrorHandler.java +17 -10
  40. data/ext/java/nokogiri/internals/NokogiriBlockingQueueInputStream.java +43 -16
  41. data/ext/java/nokogiri/internals/NokogiriDomParser.java +65 -50
  42. data/ext/java/nokogiri/internals/NokogiriEntityResolver.java +107 -88
  43. data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +25 -18
  44. data/ext/java/nokogiri/internals/NokogiriHandler.java +316 -254
  45. data/ext/java/nokogiri/internals/NokogiriHelpers.java +738 -622
  46. data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +186 -143
  47. data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +83 -68
  48. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +66 -49
  49. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +86 -69
  50. data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +44 -29
  51. data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +118 -101
  52. data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +34 -24
  53. data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +25 -17
  54. data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +57 -42
  55. data/ext/java/nokogiri/internals/ParserContext.java +206 -179
  56. data/ext/java/nokogiri/internals/ReaderNode.java +478 -371
  57. data/ext/java/nokogiri/internals/SaveContextVisitor.java +822 -707
  58. data/ext/java/nokogiri/internals/SchemaErrorHandler.java +28 -19
  59. data/ext/java/nokogiri/internals/XalanDTMManagerPatch.java +129 -123
  60. data/ext/java/nokogiri/internals/XmlDeclHandler.java +5 -4
  61. data/ext/java/nokogiri/internals/XmlDomParserContext.java +208 -177
  62. data/ext/java/nokogiri/internals/XmlSaxParser.java +24 -17
  63. data/ext/java/nokogiri/internals/c14n/AttrCompare.java +71 -68
  64. data/ext/java/nokogiri/internals/c14n/C14nHelper.java +137 -118
  65. data/ext/java/nokogiri/internals/c14n/CanonicalFilter.java +27 -21
  66. data/ext/java/nokogiri/internals/c14n/CanonicalizationException.java +74 -61
  67. data/ext/java/nokogiri/internals/c14n/Canonicalizer.java +230 -205
  68. data/ext/java/nokogiri/internals/c14n/Canonicalizer11.java +572 -547
  69. data/ext/java/nokogiri/internals/c14n/Canonicalizer11_OmitComments.java +17 -10
  70. data/ext/java/nokogiri/internals/c14n/Canonicalizer11_WithComments.java +17 -10
  71. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java +323 -302
  72. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java +232 -219
  73. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclOmitComments.java +22 -15
  74. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclWithComments.java +23 -16
  75. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315OmitComments.java +23 -16
  76. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315WithComments.java +22 -15
  77. data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +575 -545
  78. data/ext/java/nokogiri/internals/c14n/CanonicalizerPhysical.java +141 -120
  79. data/ext/java/nokogiri/internals/c14n/CanonicalizerSpi.java +39 -38
  80. data/ext/java/nokogiri/internals/c14n/Constants.java +13 -10
  81. data/ext/java/nokogiri/internals/c14n/ElementProxy.java +279 -247
  82. data/ext/java/nokogiri/internals/c14n/HelperNodeList.java +66 -53
  83. data/ext/java/nokogiri/internals/c14n/IgnoreAllErrorHandler.java +44 -37
  84. data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +135 -120
  85. data/ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java +59 -48
  86. data/ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java +384 -334
  87. data/ext/java/nokogiri/internals/c14n/NodeFilter.java +25 -24
  88. data/ext/java/nokogiri/internals/c14n/UtfHelpper.java +151 -140
  89. data/ext/java/nokogiri/internals/c14n/XMLUtils.java +456 -423
  90. data/ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java +1466 -1500
  91. data/ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java +626 -570
  92. data/ext/nokogiri/depend +34 -474
  93. data/ext/nokogiri/extconf.rb +253 -183
  94. data/ext/nokogiri/html_document.c +10 -15
  95. data/ext/nokogiri/html_element_description.c +84 -71
  96. data/ext/nokogiri/html_entity_lookup.c +21 -16
  97. data/ext/nokogiri/html_sax_parser_context.c +66 -65
  98. data/ext/nokogiri/html_sax_push_parser.c +29 -27
  99. data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
  100. data/ext/nokogiri/nokogiri.c +171 -63
  101. data/ext/nokogiri/test_global_handlers.c +3 -4
  102. data/ext/nokogiri/xml_attr.c +15 -15
  103. data/ext/nokogiri/xml_attribute_decl.c +18 -18
  104. data/ext/nokogiri/xml_cdata.c +13 -18
  105. data/ext/nokogiri/xml_comment.c +19 -26
  106. data/ext/nokogiri/xml_document.c +221 -164
  107. data/ext/nokogiri/xml_document_fragment.c +13 -15
  108. data/ext/nokogiri/xml_dtd.c +54 -48
  109. data/ext/nokogiri/xml_element_content.c +30 -27
  110. data/ext/nokogiri/xml_element_decl.c +22 -22
  111. data/ext/nokogiri/xml_encoding_handler.c +17 -11
  112. data/ext/nokogiri/xml_entity_decl.c +32 -30
  113. data/ext/nokogiri/xml_entity_reference.c +16 -18
  114. data/ext/nokogiri/xml_namespace.c +56 -49
  115. data/ext/nokogiri/xml_node.c +338 -286
  116. data/ext/nokogiri/xml_node_set.c +168 -156
  117. data/ext/nokogiri/xml_processing_instruction.c +17 -19
  118. data/ext/nokogiri/xml_reader.c +191 -157
  119. data/ext/nokogiri/xml_relax_ng.c +29 -23
  120. data/ext/nokogiri/xml_sax_parser.c +117 -112
  121. data/ext/nokogiri/xml_sax_parser_context.c +100 -85
  122. data/ext/nokogiri/xml_sax_push_parser.c +34 -27
  123. data/ext/nokogiri/xml_schema.c +48 -42
  124. data/ext/nokogiri/xml_syntax_error.c +21 -23
  125. data/ext/nokogiri/xml_text.c +13 -17
  126. data/ext/nokogiri/xml_xpath_context.c +134 -127
  127. data/ext/nokogiri/xslt_stylesheet.c +157 -157
  128. data/lib/nokogiri.rb +1 -22
  129. data/lib/nokogiri/css/parser.rb +1 -1
  130. data/lib/nokogiri/extension.rb +26 -0
  131. data/lib/nokogiri/html/document_fragment.rb +15 -15
  132. data/lib/nokogiri/nokogiri.jar +0 -0
  133. data/lib/nokogiri/version/constant.rb +1 -1
  134. data/lib/nokogiri/version/info.rb +31 -8
  135. data/lib/nokogiri/xml/document.rb +31 -11
  136. data/lib/nokogiri/xml/node.rb +38 -42
  137. data/lib/nokogiri/xml/reader.rb +2 -9
  138. data/lib/nokogiri/xml/xpath.rb +1 -3
  139. data/lib/nokogiri/xml/xpath/syntax_error.rb +1 -1
  140. metadata +7 -8
  141. data/ext/nokogiri/xml_io.c +0 -63
  142. data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
@@ -57,239 +57,279 @@ import org.w3c.dom.DOMException;
57
57
  * in DTM space, but given how DOM2DTM is currently written I think
58
58
  * this is simplest.
59
59
  * */
60
- public class DOM2DTMdefaultNamespaceDeclarationNode implements Attr,TypeInfo
60
+ public class DOM2DTMdefaultNamespaceDeclarationNode implements Attr, TypeInfo
61
61
  {
62
- final String NOT_SUPPORTED_ERR="Unsupported operation on pseudonode";
62
+ final String NOT_SUPPORTED_ERR = "Unsupported operation on pseudonode";
63
63
 
64
64
  Element pseudoparent;
65
- String prefix,uri,nodename;
65
+ String prefix, uri, nodename;
66
66
  int handle;
67
- DOM2DTMdefaultNamespaceDeclarationNode(Element pseudoparent,String prefix,String uri,int handle)
67
+ DOM2DTMdefaultNamespaceDeclarationNode(Element pseudoparent, String prefix, String uri, int handle)
68
68
  {
69
- this.pseudoparent=pseudoparent;
70
- this.prefix=prefix;
71
- this.uri=uri;
72
- this.handle=handle;
73
- this.nodename="xmlns:"+prefix;
69
+ this.pseudoparent = pseudoparent;
70
+ this.prefix = prefix;
71
+ this.uri = uri;
72
+ this.handle = handle;
73
+ this.nodename = "xmlns:" + prefix;
74
+ }
75
+ public String
76
+ getNodeName() {return nodename;}
77
+ public String
78
+ getName() {return nodename;}
79
+ public String
80
+ getNamespaceURI() {return "http://www.w3.org/2000/xmlns/";}
81
+ public String
82
+ getPrefix() {return prefix;}
83
+ public String
84
+ getLocalName() {return prefix;}
85
+ public String
86
+ getNodeValue() {return uri;}
87
+ public String
88
+ getValue() {return uri;}
89
+ public Element
90
+ getOwnerElement() {return pseudoparent;}
91
+
92
+ public boolean
93
+ isSupported(String feature, String version) {return false;}
94
+ public boolean
95
+ hasChildNodes() {return false;}
96
+ public boolean
97
+ hasAttributes() {return false;}
98
+ public Node
99
+ getParentNode() {return null;}
100
+ public Node
101
+ getFirstChild() {return null;}
102
+ public Node
103
+ getLastChild() {return null;}
104
+ public Node
105
+ getPreviousSibling() {return null;}
106
+ public Node
107
+ getNextSibling() {return null;}
108
+ public boolean
109
+ getSpecified() {return false;}
110
+ public void
111
+ normalize() {return;}
112
+ public NodeList
113
+ getChildNodes() {return null;}
114
+ public NamedNodeMap
115
+ getAttributes() {return null;}
116
+ public short
117
+ getNodeType() {return Node.ATTRIBUTE_NODE;}
118
+ public void
119
+ setNodeValue(String value) {throw new DTMException(NOT_SUPPORTED_ERR);}
120
+ public void
121
+ setValue(String value) {throw new DTMException(NOT_SUPPORTED_ERR);}
122
+ public void
123
+ setPrefix(String value) {throw new DTMException(NOT_SUPPORTED_ERR);}
124
+ public Node
125
+ insertBefore(Node a, Node b) {throw new DTMException(NOT_SUPPORTED_ERR);}
126
+ public Node
127
+ replaceChild(Node a, Node b) {throw new DTMException(NOT_SUPPORTED_ERR);}
128
+ public Node
129
+ appendChild(Node a) {throw new DTMException(NOT_SUPPORTED_ERR);}
130
+ public Node
131
+ removeChild(Node a) {throw new DTMException(NOT_SUPPORTED_ERR);}
132
+ public Document
133
+ getOwnerDocument() {return pseudoparent.getOwnerDocument();}
134
+ public Node
135
+ cloneNode(boolean deep) {throw new DTMException(NOT_SUPPORTED_ERR);}
136
+
137
+ /** Non-DOM method, part of the temporary kluge
138
+ * %REVIEW% This would be a pruning problem, but since it will always be
139
+ * added to the root element and we prune on elements, we shouldn't have
140
+ * to worry.
141
+ */
142
+ public int
143
+ getHandleOfNode()
144
+ {
145
+ return handle;
74
146
  }
75
- public String getNodeName() {return nodename;}
76
- public String getName() {return nodename;}
77
- public String getNamespaceURI() {return "http://www.w3.org/2000/xmlns/";}
78
- public String getPrefix() {return prefix;}
79
- public String getLocalName() {return prefix;}
80
- public String getNodeValue() {return uri;}
81
- public String getValue() {return uri;}
82
- public Element getOwnerElement() {return pseudoparent;}
83
-
84
- public boolean isSupported(String feature, String version) {return false;}
85
- public boolean hasChildNodes() {return false;}
86
- public boolean hasAttributes() {return false;}
87
- public Node getParentNode() {return null;}
88
- public Node getFirstChild() {return null;}
89
- public Node getLastChild() {return null;}
90
- public Node getPreviousSibling() {return null;}
91
- public Node getNextSibling() {return null;}
92
- public boolean getSpecified() {return false;}
93
- public void normalize() {return;}
94
- public NodeList getChildNodes() {return null;}
95
- public NamedNodeMap getAttributes() {return null;}
96
- public short getNodeType() {return Node.ATTRIBUTE_NODE;}
97
- public void setNodeValue(String value) {throw new DTMException(NOT_SUPPORTED_ERR);}
98
- public void setValue(String value) {throw new DTMException(NOT_SUPPORTED_ERR);}
99
- public void setPrefix(String value) {throw new DTMException(NOT_SUPPORTED_ERR);}
100
- public Node insertBefore(Node a, Node b) {throw new DTMException(NOT_SUPPORTED_ERR);}
101
- public Node replaceChild(Node a, Node b) {throw new DTMException(NOT_SUPPORTED_ERR);}
102
- public Node appendChild(Node a) {throw new DTMException(NOT_SUPPORTED_ERR);}
103
- public Node removeChild(Node a) {throw new DTMException(NOT_SUPPORTED_ERR);}
104
- public Document getOwnerDocument() {return pseudoparent.getOwnerDocument();}
105
- public Node cloneNode(boolean deep) {throw new DTMException(NOT_SUPPORTED_ERR);}
106
-
107
- /** Non-DOM method, part of the temporary kluge
108
- * %REVIEW% This would be a pruning problem, but since it will always be
109
- * added to the root element and we prune on elements, we shouldn't have
110
- * to worry.
111
- */
112
- public int getHandleOfNode()
113
- {
114
- return handle;
115
- }
116
147
 
117
- //RAMESH: PENDING=> Add proper implementation for the below DOM L3 additions
148
+ //RAMESH: PENDING=> Add proper implementation for the below DOM L3 additions
149
+
150
+ /**
151
+ * @see org.w3c.dom.TypeInfo#getTypeName()
152
+ */
153
+ public String
154
+ getTypeName() {return null; }
155
+
156
+ /**
157
+ * @see org.w3c.dom.TypeInfo#getTypeNamespace()
158
+ */
159
+ public String
160
+ getTypeNamespace() { return null;}
161
+
162
+ /**
163
+ * @see or.gw3c.dom.TypeInfo#isDerivedFrom(String,String,int)
164
+ */
165
+ public boolean
166
+ isDerivedFrom(String ns, String localName, int derivationMethod)
167
+ {
168
+ return false;
169
+ }
118
170
 
119
- /**
120
- * @see org.w3c.dom.TypeInfo#getTypeName()
121
- */
122
- public String getTypeName() {return null; }
171
+ public TypeInfo
172
+ getSchemaTypeInfo() { return this; }
173
+
174
+ public boolean
175
+ isId() { return false; }
176
+
177
+ /**
178
+ * Associate an object to a key on this node. The object can later be
179
+ * retrieved from this node by calling <code>getUserData</code> with the
180
+ * same key.
181
+ * @param key The key to associate the object to.
182
+ * @param data The object to associate to the given key, or
183
+ * <code>null</code> to remove any existing association to that key.
184
+ * @param handler The handler to associate to that key, or
185
+ * <code>null</code>.
186
+ * @return Returns the <code>DOMObject</code> previously associated to
187
+ * the given key on this node, or <code>null</code> if there was none.
188
+ * @since DOM Level 3
189
+ */
190
+ public Object
191
+ setUserData(String key,
192
+ Object data,
193
+ UserDataHandler handler)
194
+ {
195
+ return getOwnerDocument().setUserData(key, data, handler);
196
+ }
123
197
 
124
- /**
125
- * @see org.w3c.dom.TypeInfo#getTypeNamespace()
126
- */
127
- public String getTypeNamespace() { return null;}
198
+ /**
199
+ * Retrieves the object associated to a key on a this node. The object
200
+ * must first have been set to this node by calling
201
+ * <code>setUserData</code> with the same key.
202
+ * @param key The key the object is associated to.
203
+ * @return Returns the <code>DOMObject</code> associated to the given key
204
+ * on this node, or <code>null</code> if there was none.
205
+ * @since DOM Level 3
206
+ */
207
+ public Object
208
+ getUserData(String key)
209
+ {
210
+ return getOwnerDocument().getUserData(key);
211
+ }
128
212
 
129
- /**
130
- * @see or.gw3c.dom.TypeInfo#isDerivedFrom(String,String,int)
131
- */
132
- public boolean isDerivedFrom( String ns, String localName, int derivationMethod ) {
213
+ /**
214
+ * This method returns a specialized object which implements the
215
+ * specialized APIs of the specified feature and version. The
216
+ * specialized object may also be obtained by using binding-specific
217
+ * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations.
218
+ * @param feature The name of the feature requested (case-insensitive).
219
+ * @param version This is the version number of the feature to test. If
220
+ * the version is <code>null</code> or the empty string, supporting
221
+ * any version of the feature will cause the method to return an
222
+ * object that supports at least one version of the feature.
223
+ * @return Returns an object which implements the specialized APIs of
224
+ * the specified feature and version, if any, or <code>null</code> if
225
+ * there is no object which implements interfaces associated with that
226
+ * feature. If the <code>DOMObject</code> returned by this method
227
+ * implements the <code>Node</code> interface, it must delegate to the
228
+ * primary core <code>Node</code> and not return results inconsistent
229
+ * with the primary core <code>Node</code> such as attributes,
230
+ * childNodes, etc.
231
+ * @since DOM Level 3
232
+ */
233
+ public Object
234
+ getFeature(String feature, String version)
235
+ {
236
+ // we don't have any alternate node, either this node does the job
237
+ // or we don't have anything that does
238
+ return isSupported(feature, version) ? this : null;
239
+ }
240
+
241
+ /**
242
+ * Tests whether two nodes are equal.
243
+ * <br>This method tests for equality of nodes, not sameness (i.e.,
244
+ * whether the two nodes are references to the same object) which can be
245
+ * tested with <code>Node.isSameNode</code>. All nodes that are the same
246
+ * will also be equal, though the reverse may not be true.
247
+ * <br>Two nodes are equal if and only if the following conditions are
248
+ * satisfied: The two nodes are of the same type.The following string
249
+ * attributes are equal: <code>nodeName</code>, <code>localName</code>,
250
+ * <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
251
+ * , <code>baseURI</code>. This is: they are both <code>null</code>, or
252
+ * they have the same length and are character for character identical.
253
+ * The <code>attributes</code> <code>NamedNodeMaps</code> are equal.
254
+ * This is: they are both <code>null</code>, or they have the same
255
+ * length and for each node that exists in one map there is a node that
256
+ * exists in the other map and is equal, although not necessarily at the
257
+ * same index.The <code>childNodes</code> <code>NodeLists</code> are
258
+ * equal. This is: they are both <code>null</code>, or they have the
259
+ * same length and contain equal nodes at the same index. This is true
260
+ * for <code>Attr</code> nodes as for any other type of node. Note that
261
+ * normalization can affect equality; to avoid this, nodes should be
262
+ * normalized before being compared.
263
+ * <br>For two <code>DocumentType</code> nodes to be equal, the following
264
+ * conditions must also be satisfied: The following string attributes
265
+ * are equal: <code>publicId</code>, <code>systemId</code>,
266
+ * <code>internalSubset</code>.The <code>entities</code>
267
+ * <code>NamedNodeMaps</code> are equal.The <code>notations</code>
268
+ * <code>NamedNodeMaps</code> are equal.
269
+ * <br>On the other hand, the following do not affect equality: the
270
+ * <code>ownerDocument</code> attribute, the <code>specified</code>
271
+ * attribute for <code>Attr</code> nodes, the
272
+ * <code>isWhitespaceInElementContent</code> attribute for
273
+ * <code>Text</code> nodes, as well as any user data or event listeners
274
+ * registered on the nodes.
275
+ * @param arg The node to compare equality with.
276
+ * @param deep If <code>true</code>, recursively compare the subtrees; if
277
+ * <code>false</code>, compare only the nodes themselves (and its
278
+ * attributes, if it is an <code>Element</code>).
279
+ * @return If the nodes, and possibly subtrees are equal,
280
+ * <code>true</code> otherwise <code>false</code>.
281
+ * @since DOM Level 3
282
+ */
283
+ public boolean
284
+ isEqualNode(Node arg)
285
+ {
286
+ if (arg == this) {
287
+ return true;
288
+ }
289
+ if (arg.getNodeType() != getNodeType()) {
290
+ return false;
291
+ }
292
+ // in theory nodeName can't be null but better be careful
293
+ // who knows what other implementations may be doing?...
294
+ if (getNodeName() == null) {
295
+ if (arg.getNodeName() != null) {
133
296
  return false;
297
+ }
298
+ } else if (!getNodeName().equals(arg.getNodeName())) {
299
+ return false;
134
300
  }
135
301
 
136
- public TypeInfo getSchemaTypeInfo() { return this; }
137
-
138
- public boolean isId( ) { return false; }
139
-
140
- /**
141
- * Associate an object to a key on this node. The object can later be
142
- * retrieved from this node by calling <code>getUserData</code> with the
143
- * same key.
144
- * @param key The key to associate the object to.
145
- * @param data The object to associate to the given key, or
146
- * <code>null</code> to remove any existing association to that key.
147
- * @param handler The handler to associate to that key, or
148
- * <code>null</code>.
149
- * @return Returns the <code>DOMObject</code> previously associated to
150
- * the given key on this node, or <code>null</code> if there was none.
151
- * @since DOM Level 3
152
- */
153
- public Object setUserData(String key,
154
- Object data,
155
- UserDataHandler handler) {
156
- return getOwnerDocument().setUserData( key, data, handler);
302
+ if (getLocalName() == null) {
303
+ if (arg.getLocalName() != null) {
304
+ return false;
305
+ }
306
+ } else if (!getLocalName().equals(arg.getLocalName())) {
307
+ return false;
157
308
  }
158
309
 
159
- /**
160
- * Retrieves the object associated to a key on a this node. The object
161
- * must first have been set to this node by calling
162
- * <code>setUserData</code> with the same key.
163
- * @param key The key the object is associated to.
164
- * @return Returns the <code>DOMObject</code> associated to the given key
165
- * on this node, or <code>null</code> if there was none.
166
- * @since DOM Level 3
167
- */
168
- public Object getUserData(String key) {
169
- return getOwnerDocument().getUserData( key);
310
+ if (getNamespaceURI() == null) {
311
+ if (arg.getNamespaceURI() != null) {
312
+ return false;
313
+ }
314
+ } else if (!getNamespaceURI().equals(arg.getNamespaceURI())) {
315
+ return false;
170
316
  }
171
317
 
172
- /**
173
- * This method returns a specialized object which implements the
174
- * specialized APIs of the specified feature and version. The
175
- * specialized object may also be obtained by using binding-specific
176
- * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations.
177
- * @param feature The name of the feature requested (case-insensitive).
178
- * @param version This is the version number of the feature to test. If
179
- * the version is <code>null</code> or the empty string, supporting
180
- * any version of the feature will cause the method to return an
181
- * object that supports at least one version of the feature.
182
- * @return Returns an object which implements the specialized APIs of
183
- * the specified feature and version, if any, or <code>null</code> if
184
- * there is no object which implements interfaces associated with that
185
- * feature. If the <code>DOMObject</code> returned by this method
186
- * implements the <code>Node</code> interface, it must delegate to the
187
- * primary core <code>Node</code> and not return results inconsistent
188
- * with the primary core <code>Node</code> such as attributes,
189
- * childNodes, etc.
190
- * @since DOM Level 3
191
- */
192
- public Object getFeature(String feature, String version) {
193
- // we don't have any alternate node, either this node does the job
194
- // or we don't have anything that does
195
- return isSupported(feature, version) ? this : null;
318
+ if (getPrefix() == null) {
319
+ if (arg.getPrefix() != null) {
320
+ return false;
321
+ }
322
+ } else if (!getPrefix().equals(arg.getPrefix())) {
323
+ return false;
196
324
  }
197
325
 
198
- /**
199
- * Tests whether two nodes are equal.
200
- * <br>This method tests for equality of nodes, not sameness (i.e.,
201
- * whether the two nodes are references to the same object) which can be
202
- * tested with <code>Node.isSameNode</code>. All nodes that are the same
203
- * will also be equal, though the reverse may not be true.
204
- * <br>Two nodes are equal if and only if the following conditions are
205
- * satisfied: The two nodes are of the same type.The following string
206
- * attributes are equal: <code>nodeName</code>, <code>localName</code>,
207
- * <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
208
- * , <code>baseURI</code>. This is: they are both <code>null</code>, or
209
- * they have the same length and are character for character identical.
210
- * The <code>attributes</code> <code>NamedNodeMaps</code> are equal.
211
- * This is: they are both <code>null</code>, or they have the same
212
- * length and for each node that exists in one map there is a node that
213
- * exists in the other map and is equal, although not necessarily at the
214
- * same index.The <code>childNodes</code> <code>NodeLists</code> are
215
- * equal. This is: they are both <code>null</code>, or they have the
216
- * same length and contain equal nodes at the same index. This is true
217
- * for <code>Attr</code> nodes as for any other type of node. Note that
218
- * normalization can affect equality; to avoid this, nodes should be
219
- * normalized before being compared.
220
- * <br>For two <code>DocumentType</code> nodes to be equal, the following
221
- * conditions must also be satisfied: The following string attributes
222
- * are equal: <code>publicId</code>, <code>systemId</code>,
223
- * <code>internalSubset</code>.The <code>entities</code>
224
- * <code>NamedNodeMaps</code> are equal.The <code>notations</code>
225
- * <code>NamedNodeMaps</code> are equal.
226
- * <br>On the other hand, the following do not affect equality: the
227
- * <code>ownerDocument</code> attribute, the <code>specified</code>
228
- * attribute for <code>Attr</code> nodes, the
229
- * <code>isWhitespaceInElementContent</code> attribute for
230
- * <code>Text</code> nodes, as well as any user data or event listeners
231
- * registered on the nodes.
232
- * @param arg The node to compare equality with.
233
- * @param deep If <code>true</code>, recursively compare the subtrees; if
234
- * <code>false</code>, compare only the nodes themselves (and its
235
- * attributes, if it is an <code>Element</code>).
236
- * @return If the nodes, and possibly subtrees are equal,
237
- * <code>true</code> otherwise <code>false</code>.
238
- * @since DOM Level 3
239
- */
240
- public boolean isEqualNode(Node arg) {
241
- if (arg == this) {
242
- return true;
243
- }
244
- if (arg.getNodeType() != getNodeType()) {
245
- return false;
246
- }
247
- // in theory nodeName can't be null but better be careful
248
- // who knows what other implementations may be doing?...
249
- if (getNodeName() == null) {
250
- if (arg.getNodeName() != null) {
251
- return false;
252
- }
253
- }
254
- else if (!getNodeName().equals(arg.getNodeName())) {
255
- return false;
256
- }
257
-
258
- if (getLocalName() == null) {
259
- if (arg.getLocalName() != null) {
260
- return false;
261
- }
262
- }
263
- else if (!getLocalName().equals(arg.getLocalName())) {
264
- return false;
265
- }
266
-
267
- if (getNamespaceURI() == null) {
268
- if (arg.getNamespaceURI() != null) {
269
- return false;
270
- }
271
- }
272
- else if (!getNamespaceURI().equals(arg.getNamespaceURI())) {
273
- return false;
274
- }
275
-
276
- if (getPrefix() == null) {
277
- if (arg.getPrefix() != null) {
278
- return false;
279
- }
280
- }
281
- else if (!getPrefix().equals(arg.getPrefix())) {
282
- return false;
283
- }
284
-
285
- if (getNodeValue() == null) {
286
- if (arg.getNodeValue() != null) {
287
- return false;
288
- }
289
- }
290
- else if (!getNodeValue().equals(arg.getNodeValue())) {
291
- return false;
292
- }
326
+ if (getNodeValue() == null) {
327
+ if (arg.getNodeValue() != null) {
328
+ return false;
329
+ }
330
+ } else if (!getNodeValue().equals(arg.getNodeValue())) {
331
+ return false;
332
+ }
293
333
  /*
294
334
  if (getBaseURI() == null) {
295
335
  if (((NodeImpl) arg).getBaseURI() != null) {
@@ -299,387 +339,403 @@ public class DOM2DTMdefaultNamespaceDeclarationNode implements Attr,TypeInfo
299
339
  else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) {
300
340
  return false;
301
341
  }
302
- */
303
-
304
- return true;
305
- }
306
-
307
- /**
308
- * DOM Level 3 - Experimental:
309
- * Look up the namespace URI associated to the given prefix, starting from this node.
310
- * Use lookupNamespaceURI(null) to lookup the default namespace
311
- *
312
- * @param namespaceURI
313
- * @return th URI for the namespace
314
- * @since DOM Level 3
315
- */
316
- public String lookupNamespaceURI(String specifiedPrefix) {
317
- short type = this.getNodeType();
318
- switch (type) {
319
- case Node.ELEMENT_NODE : {
320
-
321
- String namespace = this.getNamespaceURI();
322
- String prefix = this.getPrefix();
323
- if (namespace !=null) {
324
- // REVISIT: is it possible that prefix is empty string?
325
- if (specifiedPrefix== null && prefix==specifiedPrefix) {
326
- // looking for default namespace
327
- return namespace;
328
- } else if (prefix != null && prefix.equals(specifiedPrefix)) {
329
- // non default namespace
330
- return namespace;
331
- }
332
- }
333
- if (this.hasAttributes()) {
334
- NamedNodeMap map = this.getAttributes();
335
- int length = map.getLength();
336
- for (int i=0;i<length;i++) {
337
- Node attr = map.item(i);
338
- String attrPrefix = attr.getPrefix();
339
- String value = attr.getNodeValue();
340
- namespace = attr.getNamespaceURI();
341
- if (namespace !=null && namespace.equals("http://www.w3.org/2000/xmlns/")) {
342
- // at this point we are dealing with DOM Level 2 nodes only
343
- if (specifiedPrefix == null &&
344
- attr.getNodeName().equals("xmlns")) {
345
- // default namespace
346
- return value;
347
- } else if (attrPrefix !=null &&
348
- attrPrefix.equals("xmlns") &&
349
- attr.getLocalName().equals(specifiedPrefix)) {
350
- // non default namespace
351
- return value;
352
- }
353
- }
354
- }
355
- }
356
- /*
357
- NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
358
- if (ancestor != null) {
359
- return ancestor.lookupNamespaceURI(specifiedPrefix);
360
- }
361
- */
362
-
363
- return null;
342
+ */
364
343
 
344
+ return true;
345
+ }
365
346
 
347
+ /**
348
+ * DOM Level 3 - Experimental:
349
+ * Look up the namespace URI associated to the given prefix, starting from this node.
350
+ * Use lookupNamespaceURI(null) to lookup the default namespace
351
+ *
352
+ * @param namespaceURI
353
+ * @return th URI for the namespace
354
+ * @since DOM Level 3
355
+ */
356
+ public String
357
+ lookupNamespaceURI(String specifiedPrefix)
358
+ {
359
+ short type = this.getNodeType();
360
+ switch (type) {
361
+ case Node.ELEMENT_NODE : {
362
+
363
+ String namespace = this.getNamespaceURI();
364
+ String prefix = this.getPrefix();
365
+ if (namespace != null) {
366
+ // REVISIT: is it possible that prefix is empty string?
367
+ if (specifiedPrefix == null && prefix == specifiedPrefix) {
368
+ // looking for default namespace
369
+ return namespace;
370
+ } else if (prefix != null && prefix.equals(specifiedPrefix)) {
371
+ // non default namespace
372
+ return namespace;
373
+ }
374
+ }
375
+ if (this.hasAttributes()) {
376
+ NamedNodeMap map = this.getAttributes();
377
+ int length = map.getLength();
378
+ for (int i = 0; i < length; i++) {
379
+ Node attr = map.item(i);
380
+ String attrPrefix = attr.getPrefix();
381
+ String value = attr.getNodeValue();
382
+ namespace = attr.getNamespaceURI();
383
+ if (namespace != null && namespace.equals("http://www.w3.org/2000/xmlns/")) {
384
+ // at this point we are dealing with DOM Level 2 nodes only
385
+ if (specifiedPrefix == null &&
386
+ attr.getNodeName().equals("xmlns")) {
387
+ // default namespace
388
+ return value;
389
+ } else if (attrPrefix != null &&
390
+ attrPrefix.equals("xmlns") &&
391
+ attr.getLocalName().equals(specifiedPrefix)) {
392
+ // non default namespace
393
+ return value;
366
394
  }
367
- /*
368
- case Node.DOCUMENT_NODE : {
369
- return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix) ;
370
- }
371
- */
372
- case Node.ENTITY_NODE :
373
- case Node.NOTATION_NODE:
374
- case Node.DOCUMENT_FRAGMENT_NODE:
375
- case Node.DOCUMENT_TYPE_NODE:
376
- // type is unknown
377
- return null;
378
- case Node.ATTRIBUTE_NODE:{
379
- if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
380
- return getOwnerElement().lookupNamespaceURI(specifiedPrefix);
395
+ }
396
+ }
397
+ }
398
+ /*
399
+ NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
400
+ if (ancestor != null) {
401
+ return ancestor.lookupNamespaceURI(specifiedPrefix);
402
+ }
403
+ */
381
404
 
382
- }
383
- return null;
384
- }
385
- default:{
386
- /*
387
- NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
388
- if (ancestor != null) {
389
- return ancestor.lookupNamespaceURI(specifiedPrefix);
390
- }
391
- */
392
- return null;
393
- }
405
+ return null;
394
406
 
395
- }
396
- }
397
407
 
398
- /**
399
- * DOM Level 3: Experimental
400
- * This method checks if the specified <code>namespaceURI</code> is the
401
- * default namespace or not.
402
- * @param namespaceURI The namespace URI to look for.
403
- * @return <code>true</code> if the specified <code>namespaceURI</code>
404
- * is the default namespace, <code>false</code> otherwise.
405
- * @since DOM Level 3
406
- */
407
- public boolean isDefaultNamespace(String namespaceURI){
408
- /*
409
- // REVISIT: remove casts when DOM L3 becomes REC.
410
- short type = this.getNodeType();
411
- switch (type) {
412
- case Node.ELEMENT_NODE: {
413
- String namespace = this.getNamespaceURI();
414
- String prefix = this.getPrefix();
415
-
416
- // REVISIT: is it possible that prefix is empty string?
417
- if (prefix == null || prefix.length() == 0) {
418
- if (namespaceURI == null) {
419
- return (namespace == namespaceURI);
420
- }
421
- return namespaceURI.equals(namespace);
422
- }
423
- if (this.hasAttributes()) {
424
- ElementImpl elem = (ElementImpl)this;
425
- NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns");
426
- if (attr != null) {
427
- String value = attr.getNodeValue();
428
- if (namespaceURI == null) {
429
- return (namespace == value);
430
- }
431
- return namespaceURI.equals(value);
408
+ }
409
+ /*
410
+ case Node.DOCUMENT_NODE : {
411
+ return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix) ;
432
412
  }
433
- }
413
+ */
414
+ case Node.ENTITY_NODE :
415
+ case Node.NOTATION_NODE:
416
+ case Node.DOCUMENT_FRAGMENT_NODE:
417
+ case Node.DOCUMENT_TYPE_NODE:
418
+ // type is unknown
419
+ return null;
420
+ case Node.ATTRIBUTE_NODE: {
421
+ if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
422
+ return getOwnerElement().lookupNamespaceURI(specifiedPrefix);
423
+
424
+ }
425
+ return null;
426
+ }
427
+ default: {
428
+ /*
429
+ NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
430
+ if (ancestor != null) {
431
+ return ancestor.lookupNamespaceURI(specifiedPrefix);
432
+ }
433
+ */
434
+ return null;
435
+ }
434
436
 
435
- NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
436
- if (ancestor != null) {
437
- return ancestor.isDefaultNamespace(namespaceURI);
438
- }
439
- return false;
440
- }
441
- case Node.DOCUMENT_NODE:{
442
- return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI);
443
- }
437
+ }
438
+ }
444
439
 
445
- case Node.ENTITY_NODE :
446
- case Node.NOTATION_NODE:
447
- case Node.DOCUMENT_FRAGMENT_NODE:
448
- case Node.DOCUMENT_TYPE_NODE:
449
- // type is unknown
450
- return false;
451
- case Node.ATTRIBUTE_NODE:{
452
- if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) {
453
- return ownerNode.isDefaultNamespace(namespaceURI);
440
+ /**
441
+ * DOM Level 3: Experimental
442
+ * This method checks if the specified <code>namespaceURI</code> is the
443
+ * default namespace or not.
444
+ * @param namespaceURI The namespace URI to look for.
445
+ * @return <code>true</code> if the specified <code>namespaceURI</code>
446
+ * is the default namespace, <code>false</code> otherwise.
447
+ * @since DOM Level 3
448
+ */
449
+ public boolean
450
+ isDefaultNamespace(String namespaceURI)
451
+ {
452
+ /*
453
+ // REVISIT: remove casts when DOM L3 becomes REC.
454
+ short type = this.getNodeType();
455
+ switch (type) {
456
+ case Node.ELEMENT_NODE: {
457
+ String namespace = this.getNamespaceURI();
458
+ String prefix = this.getPrefix();
459
+
460
+ // REVISIT: is it possible that prefix is empty string?
461
+ if (prefix == null || prefix.length() == 0) {
462
+ if (namespaceURI == null) {
463
+ return (namespace == namespaceURI);
464
+ }
465
+ return namespaceURI.equals(namespace);
466
+ }
467
+ if (this.hasAttributes()) {
468
+ ElementImpl elem = (ElementImpl)this;
469
+ NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns");
470
+ if (attr != null) {
471
+ String value = attr.getNodeValue();
472
+ if (namespaceURI == null) {
473
+ return (namespace == value);
474
+ }
475
+ return namespaceURI.equals(value);
476
+ }
477
+ }
454
478
 
455
- }
456
- return false;
457
- }
458
- default:{
459
- NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
460
- if (ancestor != null) {
461
- return ancestor.isDefaultNamespace(namespaceURI);
462
- }
463
- return false;
464
- }
479
+ NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
480
+ if (ancestor != null) {
481
+ return ancestor.isDefaultNamespace(namespaceURI);
482
+ }
483
+ return false;
484
+ }
485
+ case Node.DOCUMENT_NODE:{
486
+ return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI);
487
+ }
465
488
 
466
- }
467
- */
468
- return false;
489
+ case Node.ENTITY_NODE :
490
+ case Node.NOTATION_NODE:
491
+ case Node.DOCUMENT_FRAGMENT_NODE:
492
+ case Node.DOCUMENT_TYPE_NODE:
493
+ // type is unknown
494
+ return false;
495
+ case Node.ATTRIBUTE_NODE:{
496
+ if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) {
497
+ return ownerNode.isDefaultNamespace(namespaceURI);
498
+
499
+ }
500
+ return false;
501
+ }
502
+ default:{
503
+ NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
504
+ if (ancestor != null) {
505
+ return ancestor.isDefaultNamespace(namespaceURI);
506
+ }
507
+ return false;
508
+ }
469
509
 
510
+ }
511
+ */
512
+ return false;
470
513
 
471
- }
472
514
 
473
- /**
474
- *
475
- * DOM Level 3 - Experimental:
476
- * Look up the prefix associated to the given namespace URI, starting from this node.
477
- *
478
- * @param namespaceURI
479
- * @return the prefix for the namespace
480
- */
481
- public String lookupPrefix(String namespaceURI){
482
-
483
- // REVISIT: When Namespaces 1.1 comes out this may not be true
484
- // Prefix can't be bound to null namespace
485
- if (namespaceURI == null) {
486
- return null;
487
- }
515
+ }
488
516
 
489
- short type = this.getNodeType();
517
+ /**
518
+ *
519
+ * DOM Level 3 - Experimental:
520
+ * Look up the prefix associated to the given namespace URI, starting from this node.
521
+ *
522
+ * @param namespaceURI
523
+ * @return the prefix for the namespace
524
+ */
525
+ public String
526
+ lookupPrefix(String namespaceURI)
527
+ {
490
528
 
491
- switch (type) {
492
- /*
493
- case Node.ELEMENT_NODE: {
529
+ // REVISIT: When Namespaces 1.1 comes out this may not be true
530
+ // Prefix can't be bound to null namespace
531
+ if (namespaceURI == null) {
532
+ return null;
533
+ }
494
534
 
495
- String namespace = this.getNamespaceURI(); // to flip out children
496
- return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
497
- }
535
+ short type = this.getNodeType();
498
536
 
499
- case Node.DOCUMENT_NODE:{
500
- return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
501
- }
502
- */
503
- case Node.ENTITY_NODE :
504
- case Node.NOTATION_NODE:
505
- case Node.DOCUMENT_FRAGMENT_NODE:
506
- case Node.DOCUMENT_TYPE_NODE:
507
- // type is unknown
508
- return null;
509
- case Node.ATTRIBUTE_NODE:{
510
- if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
511
- return getOwnerElement().lookupPrefix(namespaceURI);
537
+ switch (type) {
538
+ /*
539
+ case Node.ELEMENT_NODE: {
512
540
 
541
+ String namespace = this.getNamespaceURI(); // to flip out children
542
+ return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
513
543
  }
514
- return null;
515
- }
516
- default:{
517
- /*
518
- NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
519
- if (ancestor != null) {
520
- return ancestor.lookupPrefix(namespaceURI);
544
+
545
+ case Node.DOCUMENT_NODE:{
546
+ return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
521
547
  }
522
- */
523
- return null;
524
- }
525
- }
548
+ */
549
+ case Node.ENTITY_NODE :
550
+ case Node.NOTATION_NODE:
551
+ case Node.DOCUMENT_FRAGMENT_NODE:
552
+ case Node.DOCUMENT_TYPE_NODE:
553
+ // type is unknown
554
+ return null;
555
+ case Node.ATTRIBUTE_NODE: {
556
+ if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
557
+ return getOwnerElement().lookupPrefix(namespaceURI);
558
+
559
+ }
560
+ return null;
526
561
  }
527
-
528
- /**
529
- * Returns whether this node is the same node as the given one.
530
- * <br>This method provides a way to determine whether two
531
- * <code>Node</code> references returned by the implementation reference
532
- * the same object. When two <code>Node</code> references are references
533
- * to the same object, even if through a proxy, the references may be
534
- * used completely interchangably, such that all attributes have the
535
- * same values and calling the same DOM method on either reference
536
- * always has exactly the same effect.
537
- * @param other The node to test against.
538
- * @return Returns <code>true</code> if the nodes are the same,
539
- * <code>false</code> otherwise.
540
- * @since DOM Level 3
541
- */
542
- public boolean isSameNode(Node other) {
543
- // we do not use any wrapper so the answer is obvious
544
- return this == other;
562
+ default: {
563
+ /*
564
+ NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
565
+ if (ancestor != null) {
566
+ return ancestor.lookupPrefix(namespaceURI);
567
+ }
568
+ */
569
+ return null;
545
570
  }
546
-
547
- /**
548
- * This attribute returns the text content of this node and its
549
- * descendants. When it is defined to be null, setting it has no effect.
550
- * When set, any possible children this node may have are removed and
551
- * replaced by a single <code>Text</code> node containing the string
552
- * this attribute is set to. On getting, no serialization is performed,
553
- * the returned string does not contain any markup. No whitespace
554
- * normalization is performed, the returned string does not contain the
555
- * element content whitespaces . Similarly, on setting, no parsing is
556
- * performed either, the input string is taken as pure textual content.
557
- * <br>The string returned is made of the text content of this node
558
- * depending on its type, as defined below:
559
- * <table border='1'>
560
- * <tr>
561
- * <th>Node type</th>
562
- * <th>Content</th>
563
- * </tr>
564
- * <tr>
565
- * <td valign='top' rowspan='1' colspan='1'>
566
- * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
567
- * DOCUMENT_FRAGMENT_NODE</td>
568
- * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
569
- * attribute value of every child node, excluding COMMENT_NODE and
570
- * PROCESSING_INSTRUCTION_NODE nodes</td>
571
- * </tr>
572
- * <tr>
573
- * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
574
- * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
575
- * <td valign='top' rowspan='1' colspan='1'>
576
- * <code>nodeValue</code></td>
577
- * </tr>
578
- * <tr>
579
- * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
580
- * <td valign='top' rowspan='1' colspan='1'>
581
- * null</td>
582
- * </tr>
583
- * </table>
584
- * @exception DOMException
585
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
586
- * @exception DOMException
587
- * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
588
- * fit in a <code>DOMString</code> variable on the implementation
589
- * platform.
590
- * @since DOM Level 3
591
- */
592
- public void setTextContent(String textContent)
593
- throws DOMException {
594
- setNodeValue(textContent);
595
571
  }
572
+ }
596
573
 
597
- /**
598
- * This attribute returns the text content of this node and its
599
- * descendants. When it is defined to be null, setting it has no effect.
600
- * When set, any possible children this node may have are removed and
601
- * replaced by a single <code>Text</code> node containing the string
602
- * this attribute is set to. On getting, no serialization is performed,
603
- * the returned string does not contain any markup. No whitespace
604
- * normalization is performed, the returned string does not contain the
605
- * element content whitespaces . Similarly, on setting, no parsing is
606
- * performed either, the input string is taken as pure textual content.
607
- * <br>The string returned is made of the text content of this node
608
- * depending on its type, as defined below:
609
- * <table border='1'>
610
- * <tr>
611
- * <th>Node type</th>
612
- * <th>Content</th>
613
- * </tr>
614
- * <tr>
615
- * <td valign='top' rowspan='1' colspan='1'>
616
- * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
617
- * DOCUMENT_FRAGMENT_NODE</td>
618
- * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
619
- * attribute value of every child node, excluding COMMENT_NODE and
620
- * PROCESSING_INSTRUCTION_NODE nodes</td>
621
- * </tr>
622
- * <tr>
623
- * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
624
- * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
625
- * <td valign='top' rowspan='1' colspan='1'>
626
- * <code>nodeValue</code></td>
627
- * </tr>
628
- * <tr>
629
- * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
630
- * <td valign='top' rowspan='1' colspan='1'>
631
- * null</td>
632
- * </tr>
633
- * </table>
634
- * @exception DOMException
635
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
636
- * @exception DOMException
637
- * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
638
- * fit in a <code>DOMString</code> variable on the implementation
639
- * platform.
640
- * @since DOM Level 3
641
- */
642
- public String getTextContent() throws DOMException {
643
- return getNodeValue(); // overriden in some subclasses
644
- }
574
+ /**
575
+ * Returns whether this node is the same node as the given one.
576
+ * <br>This method provides a way to determine whether two
577
+ * <code>Node</code> references returned by the implementation reference
578
+ * the same object. When two <code>Node</code> references are references
579
+ * to the same object, even if through a proxy, the references may be
580
+ * used completely interchangably, such that all attributes have the
581
+ * same values and calling the same DOM method on either reference
582
+ * always has exactly the same effect.
583
+ * @param other The node to test against.
584
+ * @return Returns <code>true</code> if the nodes are the same,
585
+ * <code>false</code> otherwise.
586
+ * @since DOM Level 3
587
+ */
588
+ public boolean
589
+ isSameNode(Node other)
590
+ {
591
+ // we do not use any wrapper so the answer is obvious
592
+ return this == other;
593
+ }
645
594
 
646
- /**
647
- * Compares a node with this node with regard to their position in the
648
- * document.
649
- * @param other The node to compare against this node.
650
- * @return Returns how the given node is positioned relatively to this
651
- * node.
652
- * @since DOM Level 3
653
- */
654
- public short compareDocumentPosition(Node other) throws DOMException {
655
- return 0;
656
- }
595
+ /**
596
+ * This attribute returns the text content of this node and its
597
+ * descendants. When it is defined to be null, setting it has no effect.
598
+ * When set, any possible children this node may have are removed and
599
+ * replaced by a single <code>Text</code> node containing the string
600
+ * this attribute is set to. On getting, no serialization is performed,
601
+ * the returned string does not contain any markup. No whitespace
602
+ * normalization is performed, the returned string does not contain the
603
+ * element content whitespaces . Similarly, on setting, no parsing is
604
+ * performed either, the input string is taken as pure textual content.
605
+ * <br>The string returned is made of the text content of this node
606
+ * depending on its type, as defined below:
607
+ * <table border='1'>
608
+ * <tr>
609
+ * <th>Node type</th>
610
+ * <th>Content</th>
611
+ * </tr>
612
+ * <tr>
613
+ * <td valign='top' rowspan='1' colspan='1'>
614
+ * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
615
+ * DOCUMENT_FRAGMENT_NODE</td>
616
+ * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
617
+ * attribute value of every child node, excluding COMMENT_NODE and
618
+ * PROCESSING_INSTRUCTION_NODE nodes</td>
619
+ * </tr>
620
+ * <tr>
621
+ * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
622
+ * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
623
+ * <td valign='top' rowspan='1' colspan='1'>
624
+ * <code>nodeValue</code></td>
625
+ * </tr>
626
+ * <tr>
627
+ * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
628
+ * <td valign='top' rowspan='1' colspan='1'>
629
+ * null</td>
630
+ * </tr>
631
+ * </table>
632
+ * @exception DOMException
633
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
634
+ * @exception DOMException
635
+ * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
636
+ * fit in a <code>DOMString</code> variable on the implementation
637
+ * platform.
638
+ * @since DOM Level 3
639
+ */
640
+ public void
641
+ setTextContent(String textContent)
642
+ throws DOMException
643
+ {
644
+ setNodeValue(textContent);
645
+ }
657
646
 
658
- /**
659
- * The absolute base URI of this node or <code>null</code> if undefined.
660
- * This value is computed according to . However, when the
661
- * <code>Document</code> supports the feature "HTML" , the base URI is
662
- * computed using first the value of the href attribute of the HTML BASE
663
- * element if any, and the value of the <code>documentURI</code>
664
- * attribute from the <code>Document</code> interface otherwise.
665
- * <br> When the node is an <code>Element</code>, a <code>Document</code>
666
- * or a a <code>ProcessingInstruction</code>, this attribute represents
667
- * the properties [base URI] defined in . When the node is a
668
- * <code>Notation</code>, an <code>Entity</code>, or an
669
- * <code>EntityReference</code>, this attribute represents the
670
- * properties [declaration base URI] in the . How will this be affected
671
- * by resolution of relative namespace URIs issue?It's not.Should this
672
- * only be on Document, Element, ProcessingInstruction, Entity, and
673
- * Notation nodes, according to the infoset? If not, what is it equal to
674
- * on other nodes? Null? An empty string? I think it should be the
675
- * parent's.No.Should this be read-only and computed or and actual
676
- * read-write attribute?Read-only and computed (F2F 19 Jun 2000 and
677
- * teleconference 30 May 2001).If the base HTML element is not yet
678
- * attached to a document, does the insert change the Document.baseURI?
679
- * Yes. (F2F 26 Sep 2001)
680
- * @since DOM Level 3
681
- */
682
- public String getBaseURI() {
683
- return null;
684
- }
647
+ /**
648
+ * This attribute returns the text content of this node and its
649
+ * descendants. When it is defined to be null, setting it has no effect.
650
+ * When set, any possible children this node may have are removed and
651
+ * replaced by a single <code>Text</code> node containing the string
652
+ * this attribute is set to. On getting, no serialization is performed,
653
+ * the returned string does not contain any markup. No whitespace
654
+ * normalization is performed, the returned string does not contain the
655
+ * element content whitespaces . Similarly, on setting, no parsing is
656
+ * performed either, the input string is taken as pure textual content.
657
+ * <br>The string returned is made of the text content of this node
658
+ * depending on its type, as defined below:
659
+ * <table border='1'>
660
+ * <tr>
661
+ * <th>Node type</th>
662
+ * <th>Content</th>
663
+ * </tr>
664
+ * <tr>
665
+ * <td valign='top' rowspan='1' colspan='1'>
666
+ * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
667
+ * DOCUMENT_FRAGMENT_NODE</td>
668
+ * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
669
+ * attribute value of every child node, excluding COMMENT_NODE and
670
+ * PROCESSING_INSTRUCTION_NODE nodes</td>
671
+ * </tr>
672
+ * <tr>
673
+ * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
674
+ * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
675
+ * <td valign='top' rowspan='1' colspan='1'>
676
+ * <code>nodeValue</code></td>
677
+ * </tr>
678
+ * <tr>
679
+ * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
680
+ * <td valign='top' rowspan='1' colspan='1'>
681
+ * null</td>
682
+ * </tr>
683
+ * </table>
684
+ * @exception DOMException
685
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
686
+ * @exception DOMException
687
+ * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
688
+ * fit in a <code>DOMString</code> variable on the implementation
689
+ * platform.
690
+ * @since DOM Level 3
691
+ */
692
+ public String
693
+ getTextContent() throws DOMException
694
+ {
695
+ return getNodeValue(); // overriden in some subclasses
696
+ }
697
+
698
+ /**
699
+ * Compares a node with this node with regard to their position in the
700
+ * document.
701
+ * @param other The node to compare against this node.
702
+ * @return Returns how the given node is positioned relatively to this
703
+ * node.
704
+ * @since DOM Level 3
705
+ */
706
+ public short
707
+ compareDocumentPosition(Node other) throws DOMException
708
+ {
709
+ return 0;
710
+ }
711
+
712
+ /**
713
+ * The absolute base URI of this node or <code>null</code> if undefined.
714
+ * This value is computed according to . However, when the
715
+ * <code>Document</code> supports the feature "HTML" , the base URI is
716
+ * computed using first the value of the href attribute of the HTML BASE
717
+ * element if any, and the value of the <code>documentURI</code>
718
+ * attribute from the <code>Document</code> interface otherwise.
719
+ * <br> When the node is an <code>Element</code>, a <code>Document</code>
720
+ * or a a <code>ProcessingInstruction</code>, this attribute represents
721
+ * the properties [base URI] defined in . When the node is a
722
+ * <code>Notation</code>, an <code>Entity</code>, or an
723
+ * <code>EntityReference</code>, this attribute represents the
724
+ * properties [declaration base URI] in the . How will this be affected
725
+ * by resolution of relative namespace URIs issue?It's not.Should this
726
+ * only be on Document, Element, ProcessingInstruction, Entity, and
727
+ * Notation nodes, according to the infoset? If not, what is it equal to
728
+ * on other nodes? Null? An empty string? I think it should be the
729
+ * parent's.No.Should this be read-only and computed or and actual
730
+ * read-write attribute?Read-only and computed (F2F 19 Jun 2000 and
731
+ * teleconference 30 May 2001).If the base HTML element is not yet
732
+ * attached to a document, does the insert change the Document.baseURI?
733
+ * Yes. (F2F 26 Sep 2001)
734
+ * @since DOM Level 3
735
+ */
736
+ public String
737
+ getBaseURI()
738
+ {
739
+ return null;
740
+ }
685
741
  }