nokogiri 1.11.7-java → 1.12.0-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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE-DEPENDENCIES.md +243 -22
  3. data/LICENSE.md +1 -1
  4. data/README.md +6 -5
  5. data/ext/java/nokogiri/{HtmlDocument.java → Html4Document.java} +8 -22
  6. data/ext/java/nokogiri/{HtmlElementDescription.java → Html4ElementDescription.java} +6 -6
  7. data/ext/java/nokogiri/{HtmlEntityLookup.java → Html4EntityLookup.java} +5 -5
  8. data/ext/java/nokogiri/{HtmlSaxParserContext.java → Html4SaxParserContext.java} +13 -13
  9. data/ext/java/nokogiri/{HtmlSaxPushParser.java → Html4SaxPushParser.java} +14 -14
  10. data/ext/java/nokogiri/NokogiriService.java +20 -20
  11. data/ext/java/nokogiri/XmlAttr.java +2 -2
  12. data/ext/java/nokogiri/XmlDocument.java +14 -14
  13. data/ext/java/nokogiri/XmlElementContent.java +5 -5
  14. data/ext/java/nokogiri/XmlNode.java +74 -74
  15. data/ext/java/nokogiri/XmlSaxPushParser.java +2 -2
  16. data/ext/java/nokogiri/XmlSyntaxError.java +1 -1
  17. data/ext/java/nokogiri/XmlXpathContext.java +9 -9
  18. data/ext/java/nokogiri/XsltStylesheet.java +8 -8
  19. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +4 -4
  20. data/ext/java/nokogiri/internals/NokogiriHandler.java +1 -1
  21. data/ext/java/nokogiri/internals/NokogiriHelpers.java +57 -57
  22. data/ext/java/nokogiri/internals/SaveContextVisitor.java +24 -24
  23. data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +105 -105
  24. data/ext/java/nokogiri/internals/c14n/XMLUtils.java +30 -30
  25. data/ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java +87 -87
  26. data/ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java +95 -95
  27. data/ext/nokogiri/depend +35 -34
  28. data/ext/nokogiri/extconf.rb +181 -103
  29. data/ext/nokogiri/gumbo.c +584 -0
  30. data/ext/nokogiri/{html_document.c → html4_document.c} +8 -8
  31. data/ext/nokogiri/{html_element_description.c → html4_element_description.c} +20 -18
  32. data/ext/nokogiri/{html_entity_lookup.c → html4_entity_lookup.c} +7 -7
  33. data/ext/nokogiri/{html_sax_parser_context.c → html4_sax_parser_context.c} +5 -5
  34. data/ext/nokogiri/{html_sax_push_parser.c → html4_sax_push_parser.c} +4 -4
  35. data/ext/nokogiri/libxml2_backwards_compat.c +30 -30
  36. data/ext/nokogiri/nokogiri.c +51 -38
  37. data/ext/nokogiri/xml_document.c +13 -13
  38. data/ext/nokogiri/xml_element_content.c +2 -0
  39. data/ext/nokogiri/xml_encoding_handler.c +11 -6
  40. data/ext/nokogiri/xml_namespace.c +2 -0
  41. data/ext/nokogiri/xml_node.c +102 -102
  42. data/ext/nokogiri/xml_node_set.c +20 -20
  43. data/ext/nokogiri/xml_reader.c +2 -0
  44. data/ext/nokogiri/xml_sax_parser.c +6 -6
  45. data/ext/nokogiri/xml_sax_parser_context.c +2 -0
  46. data/ext/nokogiri/xml_schema.c +2 -0
  47. data/ext/nokogiri/xml_xpath_context.c +67 -65
  48. data/ext/nokogiri/xslt_stylesheet.c +2 -1
  49. data/gumbo-parser/CHANGES.md +63 -0
  50. data/gumbo-parser/Makefile +101 -0
  51. data/gumbo-parser/THANKS +27 -0
  52. data/lib/nokogiri.rb +31 -29
  53. data/lib/nokogiri/css.rb +14 -14
  54. data/lib/nokogiri/css/parser.rb +1 -1
  55. data/lib/nokogiri/css/parser.y +1 -1
  56. data/lib/nokogiri/css/syntax_error.rb +1 -1
  57. data/lib/nokogiri/extension.rb +2 -2
  58. data/lib/nokogiri/gumbo.rb +14 -0
  59. data/lib/nokogiri/html.rb +31 -27
  60. data/lib/nokogiri/html4.rb +40 -0
  61. data/lib/nokogiri/{html → html4}/builder.rb +2 -2
  62. data/lib/nokogiri/{html → html4}/document.rb +4 -4
  63. data/lib/nokogiri/{html → html4}/document_fragment.rb +3 -3
  64. data/lib/nokogiri/{html → html4}/element_description.rb +1 -1
  65. data/lib/nokogiri/{html → html4}/element_description_defaults.rb +1 -1
  66. data/lib/nokogiri/{html → html4}/entity_lookup.rb +1 -1
  67. data/lib/nokogiri/{html → html4}/sax/parser.rb +11 -14
  68. data/lib/nokogiri/html4/sax/parser_context.rb +19 -0
  69. data/lib/nokogiri/{html → html4}/sax/push_parser.rb +5 -5
  70. data/lib/nokogiri/html5.rb +473 -0
  71. data/lib/nokogiri/html5/document.rb +74 -0
  72. data/lib/nokogiri/html5/document_fragment.rb +80 -0
  73. data/lib/nokogiri/html5/node.rb +93 -0
  74. data/lib/nokogiri/nokogiri.jar +0 -0
  75. data/lib/nokogiri/version/constant.rb +1 -1
  76. data/lib/nokogiri/version/info.rb +11 -2
  77. data/lib/nokogiri/xml.rb +35 -36
  78. data/lib/nokogiri/xml/node.rb +6 -5
  79. data/lib/nokogiri/xml/parse_options.rb +2 -0
  80. data/lib/nokogiri/xml/pp.rb +2 -2
  81. data/lib/nokogiri/xml/sax.rb +4 -4
  82. data/lib/nokogiri/xml/sax/document.rb +24 -30
  83. data/lib/nokogiri/xml/xpath.rb +2 -2
  84. data/lib/nokogiri/xslt.rb +16 -16
  85. data/lib/nokogiri/xslt/stylesheet.rb +1 -1
  86. metadata +40 -40
  87. data/lib/nokogiri/html/sax/parser_context.rb +0 -17
@@ -195,43 +195,43 @@ public class XMLUtils
195
195
  final String namespaceNs = Constants.NamespaceSpecNS;
196
196
  do {
197
197
  switch (node.getNodeType()) {
198
- case Node.ELEMENT_NODE :
199
- Element element = (Element) node;
200
- if (!element.hasChildNodes()) {
201
- break;
202
- }
203
- if (element.hasAttributes()) {
204
- NamedNodeMap attributes = element.getAttributes();
205
- int attributesLength = attributes.getLength();
206
-
207
- for (Node child = element.getFirstChild(); child != null;
208
- child = child.getNextSibling()) {
198
+ case Node.ELEMENT_NODE :
199
+ Element element = (Element) node;
200
+ if (!element.hasChildNodes()) {
201
+ break;
202
+ }
203
+ if (element.hasAttributes()) {
204
+ NamedNodeMap attributes = element.getAttributes();
205
+ int attributesLength = attributes.getLength();
209
206
 
210
- if (child.getNodeType() != Node.ELEMENT_NODE) {
211
- continue;
212
- }
213
- Element childElement = (Element) child;
207
+ for (Node child = element.getFirstChild(); child != null;
208
+ child = child.getNextSibling()) {
214
209
 
215
- for (int i = 0; i < attributesLength; i++) {
216
- Attr currentAttr = (Attr) attributes.item(i);
217
- if (!namespaceNs.equals(currentAttr.getNamespaceURI())) {
210
+ if (child.getNodeType() != Node.ELEMENT_NODE) {
218
211
  continue;
219
212
  }
220
- if (childElement.hasAttributeNS(namespaceNs,
221
- currentAttr.getLocalName())) {
222
- continue;
213
+ Element childElement = (Element) child;
214
+
215
+ for (int i = 0; i < attributesLength; i++) {
216
+ Attr currentAttr = (Attr) attributes.item(i);
217
+ if (!namespaceNs.equals(currentAttr.getNamespaceURI())) {
218
+ continue;
219
+ }
220
+ if (childElement.hasAttributeNS(namespaceNs,
221
+ currentAttr.getLocalName())) {
222
+ continue;
223
+ }
224
+ childElement.setAttributeNS(namespaceNs,
225
+ currentAttr.getName(),
226
+ currentAttr.getNodeValue());
223
227
  }
224
- childElement.setAttributeNS(namespaceNs,
225
- currentAttr.getName(),
226
- currentAttr.getNodeValue());
227
228
  }
228
229
  }
229
- }
230
- case Node.ENTITY_REFERENCE_NODE :
231
- case Node.DOCUMENT_NODE :
232
- parent = node;
233
- sibling = node.getFirstChild();
234
- break;
230
+ case Node.ENTITY_REFERENCE_NODE :
231
+ case Node.DOCUMENT_NODE :
232
+ parent = node;
233
+ sibling = node.getFirstChild();
234
+ break;
235
235
  }
236
236
  while ((sibling == null) && (parent != null)) {
237
237
  sibling = parent.getNextSibling();
@@ -885,26 +885,26 @@ public class DOM2DTM extends DTMDefaultBaseIterators
885
885
  {
886
886
 
887
887
  switch (node.getNodeType()) {
888
- case Node.DOCUMENT_FRAGMENT_NODE :
889
- case Node.DOCUMENT_NODE :
890
- case Node.ELEMENT_NODE : {
891
- for (Node child = node.getFirstChild(); null != child;
892
- child = child.getNextSibling()) {
893
- getNodeData(child, buf);
888
+ case Node.DOCUMENT_FRAGMENT_NODE :
889
+ case Node.DOCUMENT_NODE :
890
+ case Node.ELEMENT_NODE : {
891
+ for (Node child = node.getFirstChild(); null != child;
892
+ child = child.getNextSibling()) {
893
+ getNodeData(child, buf);
894
+ }
894
895
  }
895
- }
896
- break;
897
- case Node.TEXT_NODE :
898
- case Node.CDATA_SECTION_NODE :
899
- case Node.ATTRIBUTE_NODE : // Never a child but might be our starting node
900
- buf.append(node.getNodeValue());
901
- break;
902
- case Node.PROCESSING_INSTRUCTION_NODE :
903
- // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
904
- break;
905
- default :
906
- // ignore
907
896
  break;
897
+ case Node.TEXT_NODE :
898
+ case Node.CDATA_SECTION_NODE :
899
+ case Node.ATTRIBUTE_NODE : // Never a child but might be our starting node
900
+ buf.append(node.getNodeValue());
901
+ break;
902
+ case Node.PROCESSING_INSTRUCTION_NODE :
903
+ // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
904
+ break;
905
+ default :
906
+ // ignore
907
+ break;
908
908
  }
909
909
  }
910
910
 
@@ -943,30 +943,30 @@ public class DOM2DTM extends DTMDefaultBaseIterators
943
943
  short type = getNodeType(nodeHandle);
944
944
 
945
945
  switch (type) {
946
- case DTM.NAMESPACE_NODE : {
947
- Node node = getNode(nodeHandle);
948
-
949
- // assume not null.
950
- name = node.getNodeName();
951
- if (name.startsWith("xmlns:")) {
952
- name = QName.getLocalPart(name);
953
- } else if (name.equals("xmlns")) {
954
- name = "";
946
+ case DTM.NAMESPACE_NODE : {
947
+ Node node = getNode(nodeHandle);
948
+
949
+ // assume not null.
950
+ name = node.getNodeName();
951
+ if (name.startsWith("xmlns:")) {
952
+ name = QName.getLocalPart(name);
953
+ } else if (name.equals("xmlns")) {
954
+ name = "";
955
+ }
955
956
  }
956
- }
957
- break;
958
- case DTM.ATTRIBUTE_NODE :
959
- case DTM.ELEMENT_NODE :
960
- case DTM.ENTITY_REFERENCE_NODE :
961
- case DTM.PROCESSING_INSTRUCTION_NODE : {
962
- Node node = getNode(nodeHandle);
963
-
964
- // assume not null.
965
- name = node.getNodeName();
966
- }
967
- break;
968
- default :
969
- name = "";
957
+ break;
958
+ case DTM.ATTRIBUTE_NODE :
959
+ case DTM.ELEMENT_NODE :
960
+ case DTM.ENTITY_REFERENCE_NODE :
961
+ case DTM.PROCESSING_INSTRUCTION_NODE : {
962
+ Node node = getNode(nodeHandle);
963
+
964
+ // assume not null.
965
+ name = node.getNodeName();
966
+ }
967
+ break;
968
+ default :
969
+ name = "";
970
970
  }
971
971
 
972
972
  return name;
@@ -1056,29 +1056,29 @@ public class DOM2DTM extends DTMDefaultBaseIterators
1056
1056
  short type = getNodeType(nodeHandle);
1057
1057
 
1058
1058
  switch (type) {
1059
- case DTM.NAMESPACE_NODE : {
1060
- Node node = getNode(nodeHandle);
1059
+ case DTM.NAMESPACE_NODE : {
1060
+ Node node = getNode(nodeHandle);
1061
1061
 
1062
- // assume not null.
1063
- String qname = node.getNodeName();
1064
- int index = qname.indexOf(':');
1062
+ // assume not null.
1063
+ String qname = node.getNodeName();
1064
+ int index = qname.indexOf(':');
1065
1065
 
1066
- prefix = (index < 0) ? "" : qname.substring(index + 1);
1067
- }
1068
- break;
1069
- case DTM.ATTRIBUTE_NODE :
1070
- case DTM.ELEMENT_NODE : {
1071
- Node node = getNode(nodeHandle);
1066
+ prefix = (index < 0) ? "" : qname.substring(index + 1);
1067
+ }
1068
+ break;
1069
+ case DTM.ATTRIBUTE_NODE :
1070
+ case DTM.ELEMENT_NODE : {
1071
+ Node node = getNode(nodeHandle);
1072
1072
 
1073
- // assume not null.
1074
- String qname = node.getNodeName();
1075
- int index = qname.indexOf(':');
1073
+ // assume not null.
1074
+ String qname = node.getNodeName();
1075
+ int index = qname.indexOf(':');
1076
1076
 
1077
- prefix = (index < 0) ? "" : qname.substring(0, index);
1078
- }
1079
- break;
1080
- default :
1081
- prefix = "";
1077
+ prefix = (index < 0) ? "" : qname.substring(0, index);
1078
+ }
1079
+ break;
1080
+ default :
1081
+ prefix = "";
1082
1082
  }
1083
1083
 
1084
1084
  return prefix;
@@ -1616,38 +1616,38 @@ public class DOM2DTM extends DTMDefaultBaseIterators
1616
1616
  {
1617
1617
 
1618
1618
  switch (node.getNodeType()) {
1619
- case Node.DOCUMENT_FRAGMENT_NODE :
1620
- case Node.DOCUMENT_NODE :
1621
- case Node.ELEMENT_NODE : {
1622
- for (Node child = node.getFirstChild(); null != child;
1623
- child = child.getNextSibling()) {
1624
- dispatchNodeData(child, ch, depth + 1);
1625
- }
1626
- }
1627
- break;
1628
- case Node.PROCESSING_INSTRUCTION_NODE : // %REVIEW%
1629
- case Node.COMMENT_NODE :
1630
- if (0 != depth) {
1631
- break;
1632
- }
1633
- // NOTE: Because this operation works in the DOM space, it does _not_ attempt
1634
- // to perform Text Coalition. That should only be done in DTM space.
1635
- case Node.TEXT_NODE :
1636
- case Node.CDATA_SECTION_NODE :
1637
- case Node.ATTRIBUTE_NODE :
1638
- String str = node.getNodeValue();
1639
- if (ch instanceof org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler) {
1640
- ((org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler)ch).characters(node);
1641
- } else {
1642
- ch.characters(str.toCharArray(), 0, str.length());
1619
+ case Node.DOCUMENT_FRAGMENT_NODE :
1620
+ case Node.DOCUMENT_NODE :
1621
+ case Node.ELEMENT_NODE : {
1622
+ for (Node child = node.getFirstChild(); null != child;
1623
+ child = child.getNextSibling()) {
1624
+ dispatchNodeData(child, ch, depth + 1);
1625
+ }
1643
1626
  }
1644
1627
  break;
1628
+ case Node.PROCESSING_INSTRUCTION_NODE : // %REVIEW%
1629
+ case Node.COMMENT_NODE :
1630
+ if (0 != depth) {
1631
+ break;
1632
+ }
1633
+ // NOTE: Because this operation works in the DOM space, it does _not_ attempt
1634
+ // to perform Text Coalition. That should only be done in DTM space.
1635
+ case Node.TEXT_NODE :
1636
+ case Node.CDATA_SECTION_NODE :
1637
+ case Node.ATTRIBUTE_NODE :
1638
+ String str = node.getNodeValue();
1639
+ if (ch instanceof org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler) {
1640
+ ((org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler)ch).characters(node);
1641
+ } else {
1642
+ ch.characters(str.toCharArray(), 0, str.length());
1643
+ }
1644
+ break;
1645
1645
  // /* case Node.PROCESSING_INSTRUCTION_NODE :
1646
1646
  // // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
1647
1647
  // break; */
1648
- default :
1649
- // ignore
1650
- break;
1648
+ default :
1649
+ // ignore
1650
+ break;
1651
1651
  }
1652
1652
  }
1653
1653
 
@@ -354,81 +354,81 @@ public class DOM2DTMdefaultNamespaceDeclarationNode implements Attr, TypeInfo
354
354
  {
355
355
  short type = this.getNodeType();
356
356
  switch (type) {
357
- case Node.ELEMENT_NODE : {
358
-
359
- String namespace = this.getNamespaceURI();
360
- String prefix = this.getPrefix();
361
- if (namespace != null) {
362
- // REVISIT: is it possible that prefix is empty string?
363
- if (specifiedPrefix == null && prefix == specifiedPrefix) {
364
- // looking for default namespace
365
- return namespace;
366
- } else if (prefix != null && prefix.equals(specifiedPrefix)) {
367
- // non default namespace
368
- return namespace;
357
+ case Node.ELEMENT_NODE : {
358
+
359
+ String namespace = this.getNamespaceURI();
360
+ String prefix = this.getPrefix();
361
+ if (namespace != null) {
362
+ // REVISIT: is it possible that prefix is empty string?
363
+ if (specifiedPrefix == null && prefix == specifiedPrefix) {
364
+ // looking for default namespace
365
+ return namespace;
366
+ } else if (prefix != null && prefix.equals(specifiedPrefix)) {
367
+ // non default namespace
368
+ return namespace;
369
+ }
369
370
  }
370
- }
371
- if (this.hasAttributes()) {
372
- NamedNodeMap map = this.getAttributes();
373
- int length = map.getLength();
374
- for (int i = 0; i < length; i++) {
375
- Node attr = map.item(i);
376
- String attrPrefix = attr.getPrefix();
377
- String value = attr.getNodeValue();
378
- namespace = attr.getNamespaceURI();
379
- if (namespace != null && namespace.equals("http://www.w3.org/2000/xmlns/")) {
380
- // at this point we are dealing with DOM Level 2 nodes only
381
- if (specifiedPrefix == null &&
382
- attr.getNodeName().equals("xmlns")) {
383
- // default namespace
384
- return value;
385
- } else if (attrPrefix != null &&
386
- attrPrefix.equals("xmlns") &&
387
- attr.getLocalName().equals(specifiedPrefix)) {
388
- // non default namespace
389
- return value;
371
+ if (this.hasAttributes()) {
372
+ NamedNodeMap map = this.getAttributes();
373
+ int length = map.getLength();
374
+ for (int i = 0; i < length; i++) {
375
+ Node attr = map.item(i);
376
+ String attrPrefix = attr.getPrefix();
377
+ String value = attr.getNodeValue();
378
+ namespace = attr.getNamespaceURI();
379
+ if (namespace != null && namespace.equals("http://www.w3.org/2000/xmlns/")) {
380
+ // at this point we are dealing with DOM Level 2 nodes only
381
+ if (specifiedPrefix == null &&
382
+ attr.getNodeName().equals("xmlns")) {
383
+ // default namespace
384
+ return value;
385
+ } else if (attrPrefix != null &&
386
+ attrPrefix.equals("xmlns") &&
387
+ attr.getLocalName().equals(specifiedPrefix)) {
388
+ // non default namespace
389
+ return value;
390
+ }
390
391
  }
391
392
  }
392
393
  }
393
- }
394
- /*
395
- NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
396
- if (ancestor != null) {
397
- return ancestor.lookupNamespaceURI(specifiedPrefix);
398
- }
399
- */
394
+ /*
395
+ NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
396
+ if (ancestor != null) {
397
+ return ancestor.lookupNamespaceURI(specifiedPrefix);
398
+ }
399
+ */
400
400
 
401
- return null;
401
+ return null;
402
402
 
403
403
 
404
- }
405
- /*
406
- case Node.DOCUMENT_NODE : {
407
- return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix) ;
408
- }
409
- */
410
- case Node.ENTITY_NODE :
411
- case Node.NOTATION_NODE:
412
- case Node.DOCUMENT_FRAGMENT_NODE:
413
- case Node.DOCUMENT_TYPE_NODE:
414
- // type is unknown
415
- return null;
416
- case Node.ATTRIBUTE_NODE: {
417
- if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
418
- return getOwnerElement().lookupNamespaceURI(specifiedPrefix);
419
-
420
404
  }
421
- return null;
422
- }
423
- default: {
424
405
  /*
425
- NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
426
- if (ancestor != null) {
427
- return ancestor.lookupNamespaceURI(specifiedPrefix);
428
- }
429
- */
430
- return null;
431
- }
406
+ case Node.DOCUMENT_NODE : {
407
+ return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix) ;
408
+ }
409
+ */
410
+ case Node.ENTITY_NODE :
411
+ case Node.NOTATION_NODE:
412
+ case Node.DOCUMENT_FRAGMENT_NODE:
413
+ case Node.DOCUMENT_TYPE_NODE:
414
+ // type is unknown
415
+ return null;
416
+ case Node.ATTRIBUTE_NODE: {
417
+ if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
418
+ return getOwnerElement().lookupNamespaceURI(specifiedPrefix);
419
+
420
+ }
421
+ return null;
422
+ }
423
+ default: {
424
+ /*
425
+ NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
426
+ if (ancestor != null) {
427
+ return ancestor.lookupNamespaceURI(specifiedPrefix);
428
+ }
429
+ */
430
+ return null;
431
+ }
432
432
 
433
433
  }
434
434
  }
@@ -531,39 +531,39 @@ public class DOM2DTMdefaultNamespaceDeclarationNode implements Attr, TypeInfo
531
531
  short type = this.getNodeType();
532
532
 
533
533
  switch (type) {
534
- /*
535
- case Node.ELEMENT_NODE: {
534
+ /*
535
+ case Node.ELEMENT_NODE: {
536
536
 
537
- String namespace = this.getNamespaceURI(); // to flip out children
538
- return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
539
- }
537
+ String namespace = this.getNamespaceURI(); // to flip out children
538
+ return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
539
+ }
540
540
 
541
- case Node.DOCUMENT_NODE:{
542
- return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
543
- }
544
- */
545
- case Node.ENTITY_NODE :
546
- case Node.NOTATION_NODE:
547
- case Node.DOCUMENT_FRAGMENT_NODE:
548
- case Node.DOCUMENT_TYPE_NODE:
549
- // type is unknown
550
- return null;
551
- case Node.ATTRIBUTE_NODE: {
552
- if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
553
- return getOwnerElement().lookupPrefix(namespaceURI);
541
+ case Node.DOCUMENT_NODE:{
542
+ return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
543
+ }
544
+ */
545
+ case Node.ENTITY_NODE :
546
+ case Node.NOTATION_NODE:
547
+ case Node.DOCUMENT_FRAGMENT_NODE:
548
+ case Node.DOCUMENT_TYPE_NODE:
549
+ // type is unknown
550
+ return null;
551
+ case Node.ATTRIBUTE_NODE: {
552
+ if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
553
+ return getOwnerElement().lookupPrefix(namespaceURI);
554
554
 
555
+ }
556
+ return null;
557
+ }
558
+ default: {
559
+ /*
560
+ NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
561
+ if (ancestor != null) {
562
+ return ancestor.lookupPrefix(namespaceURI);
563
+ }
564
+ */
565
+ return null;
555
566
  }
556
- return null;
557
- }
558
- default: {
559
- /*
560
- NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
561
- if (ancestor != null) {
562
- return ancestor.lookupPrefix(namespaceURI);
563
- }
564
- */
565
- return null;
566
- }
567
567
  }
568
568
  }
569
569