nokogiri 1.7.2-java → 1.8.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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +4 -4
  3. data/.travis.yml +43 -24
  4. data/CHANGELOG.md +54 -6
  5. data/Gemfile +8 -7
  6. data/Gemfile-libxml-ruby +3 -0
  7. data/LICENSE-DEPENDENCIES.md +1612 -0
  8. data/{LICENSE.txt → LICENSE.md} +1 -1
  9. data/Manifest.txt +5 -8
  10. data/README.md +8 -5
  11. data/Rakefile +15 -31
  12. data/appveyor.yml +2 -0
  13. data/dependencies.yml +12 -7
  14. data/ext/java/nokogiri/HtmlDocument.java +2 -2
  15. data/ext/java/nokogiri/HtmlSaxParserContext.java +20 -21
  16. data/ext/java/nokogiri/HtmlSaxPushParser.java +6 -10
  17. data/ext/java/nokogiri/NokogiriService.java +10 -31
  18. data/ext/java/nokogiri/XmlAttr.java +1 -26
  19. data/ext/java/nokogiri/XmlCdata.java +0 -1
  20. data/ext/java/nokogiri/XmlComment.java +1 -1
  21. data/ext/java/nokogiri/XmlDocument.java +4 -5
  22. data/ext/java/nokogiri/XmlDocumentFragment.java +29 -21
  23. data/ext/java/nokogiri/XmlDtd.java +1 -1
  24. data/ext/java/nokogiri/XmlElement.java +9 -10
  25. data/ext/java/nokogiri/XmlEntityDecl.java +4 -5
  26. data/ext/java/nokogiri/XmlNode.java +105 -103
  27. data/ext/java/nokogiri/XmlNodeSet.java +64 -76
  28. data/ext/java/nokogiri/XmlReader.java +48 -48
  29. data/ext/java/nokogiri/XmlRelaxng.java +1 -1
  30. data/ext/java/nokogiri/XmlSaxPushParser.java +37 -17
  31. data/ext/java/nokogiri/XmlSchema.java +7 -5
  32. data/ext/java/nokogiri/XmlSyntaxError.java +47 -35
  33. data/ext/java/nokogiri/XmlXpathContext.java +160 -132
  34. data/ext/java/nokogiri/XsltStylesheet.java +15 -24
  35. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +19 -23
  36. data/ext/java/nokogiri/internals/NokogiriDomParser.java +1 -1
  37. data/ext/java/nokogiri/internals/NokogiriEncodingReaderWrapper.java +1 -1
  38. data/ext/java/nokogiri/internals/NokogiriEntityResolver.java +11 -13
  39. data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +5 -21
  40. data/ext/java/nokogiri/internals/NokogiriHandler.java +1 -1
  41. data/ext/java/nokogiri/internals/NokogiriHelpers.java +105 -142
  42. data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +16 -26
  43. data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +32 -50
  44. data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +10 -13
  45. data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +3 -10
  46. data/ext/java/nokogiri/internals/ParserContext.java +4 -8
  47. data/ext/java/nokogiri/internals/ReaderNode.java +53 -93
  48. data/ext/java/nokogiri/internals/SaveContextVisitor.java +77 -89
  49. data/ext/java/nokogiri/internals/SchemaErrorHandler.java +6 -9
  50. data/ext/java/nokogiri/internals/XalanDTMManagerPatch.java +167 -0
  51. data/ext/java/nokogiri/internals/XmlDomParserContext.java +17 -6
  52. data/ext/java/nokogiri/internals/c14n/Canonicalizer.java +1 -1
  53. data/ext/java/nokogiri/internals/c14n/Canonicalizer11.java +28 -28
  54. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java +3 -4
  55. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java +2 -2
  56. data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +10 -10
  57. data/ext/java/nokogiri/internals/c14n/ElementProxy.java +5 -5
  58. data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +2 -2
  59. data/ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java +1 -1
  60. data/ext/java/nokogiri/internals/c14n/XMLUtils.java +2 -2
  61. data/ext/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMExt.java +1749 -0
  62. data/ext/nokogiri/extconf.rb +12 -17
  63. data/ext/nokogiri/nokogiri.h +0 -10
  64. data/ext/nokogiri/xml_attr.c +12 -8
  65. data/ext/nokogiri/xml_node.c +17 -14
  66. data/ext/nokogiri/xml_sax_push_parser.c +56 -12
  67. data/lib/nokogiri/html/sax/parser.rb +10 -0
  68. data/lib/nokogiri/nokogiri.jar +0 -0
  69. data/lib/nokogiri/version.rb +5 -4
  70. data/lib/nokogiri/xml/document.rb +9 -9
  71. data/lib/nokogiri/xml/node.rb +7 -7
  72. data/lib/nokogiri/xml/node_set.rb +12 -7
  73. data/lib/nokogiri/xml/sax/parser.rb +6 -7
  74. data/lib/nokogiri/xml/searchable.rb +34 -25
  75. data/lib/nokogiri/xml/syntax_error.rb +24 -1
  76. data/test/decorators/test_slop.rb +4 -1
  77. data/test/helper.rb +10 -0
  78. data/test/html/sax/test_parser.rb +27 -0
  79. data/test/html/test_document.rb +12 -1
  80. data/test/html/test_document_encoding.rb +1 -3
  81. data/test/html/test_document_fragment.rb +3 -0
  82. data/test/xml/sax/test_push_parser.rb +48 -0
  83. data/test/xml/test_attr.rb +7 -0
  84. data/test/xml/test_document.rb +1 -1
  85. data/test/xml/test_document_fragment.rb +27 -0
  86. data/test/xml/test_entity_reference.rb +2 -2
  87. data/test/xml/test_node.rb +12 -15
  88. data/test/xml/test_node_reparenting.rb +14 -0
  89. data/test/xml/test_node_set.rb +8 -6
  90. data/test/xml/test_reader.rb +19 -0
  91. data/test/xml/test_syntax_error.rb +21 -15
  92. data/test/xml/test_unparented_node.rb +54 -11
  93. data/test/xml/test_xpath.rb +23 -6
  94. metadata +32 -20
  95. data/ext/java/nokogiri/internals/NokogiriDocumentCache.java +0 -73
  96. data/ext/java/nokogiri/internals/XsltExtensionFunction.java +0 -72
  97. data/suppressions/nokogiri_ree-1.8.7.358.supp +0 -61
  98. data/suppressions/nokogiri_ruby-1.8.7.370.supp +0 -0
  99. data/suppressions/nokogiri_ruby-1.9.2.320.supp +0 -28
  100. data/suppressions/nokogiri_ruby-1.9.3.327.supp +0 -28
  101. data/test_all +0 -105
@@ -1,73 +0,0 @@
1
- /**
2
- * (The MIT License)
3
- *
4
- * Copyright (c) 2008 - 2011:
5
- *
6
- * * {Aaron Patterson}[http://tenderlovemaking.com]
7
- * * {Mike Dalessio}[http://mike.daless.io]
8
- * * {Charles Nutter}[http://blog.headius.com]
9
- * * {Sergio Arbeo}[http://www.serabe.com]
10
- * * {Patrick Mahoney}[http://polycrystal.org]
11
- * * {Yoko Harada}[http://yokolet.blogspot.com]
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining
14
- * a copy of this software and associated documentation files (the
15
- * 'Software'), to deal in the Software without restriction, including
16
- * without limitation the rights to use, copy, modify, merge, publish,
17
- * distribute, sublicense, and/or sell copies of the Software, and to
18
- * permit persons to whom the Software is furnished to do so, subject to
19
- * the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be
22
- * included in all copies or substantial portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
25
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
28
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
29
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
30
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
- */
32
-
33
- package nokogiri.internals;
34
-
35
- import java.util.Hashtable;
36
- import nokogiri.XmlDocument;
37
- import org.w3c.dom.Document;
38
-
39
- /**
40
- * Currently, this class is not used anywhere.
41
- * I'm not sure what for this class was written.(Yoko)
42
- *
43
- * @author sergio
44
- */
45
- public class NokogiriDocumentCache {
46
-
47
- private static NokogiriDocumentCache instance;
48
- protected Hashtable<Document, XmlDocument> cache;
49
-
50
- private NokogiriDocumentCache() {
51
- this.cache = new Hashtable<Document, XmlDocument>();
52
- }
53
-
54
- public static NokogiriDocumentCache getInstance() {
55
- if(instance == null) {
56
- instance = new NokogiriDocumentCache();
57
- }
58
- return instance;
59
- }
60
-
61
- public XmlDocument getXmlDocument(Document doc) {
62
- return this.cache.get(doc);
63
- }
64
-
65
- public void putDocument(Document doc, XmlDocument xmlDoc) {
66
- this.cache.put(doc, xmlDoc);
67
- }
68
-
69
- public XmlDocument removeDocument(Document doc) {
70
- return this.cache.remove(doc);
71
- }
72
-
73
- }
@@ -1,72 +0,0 @@
1
- /**
2
- * (The MIT License)
3
- *
4
- * Copyright (c) 2008 - 2011:
5
- *
6
- * * {Aaron Patterson}[http://tenderlovemaking.com]
7
- * * {Mike Dalessio}[http://mike.daless.io]
8
- * * {Charles Nutter}[http://blog.headius.com]
9
- * * {Sergio Arbeo}[http://www.serabe.com]
10
- * * {Patrick Mahoney}[http://polycrystal.org]
11
- * * {Yoko Harada}[http://yokolet.blogspot.com]
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining
14
- * a copy of this software and associated documentation files (the
15
- * 'Software'), to deal in the Software without restriction, including
16
- * without limitation the rights to use, copy, modify, merge, publish,
17
- * distribute, sublicense, and/or sell copies of the Software, and to
18
- * permit persons to whom the Software is furnished to do so, subject to
19
- * the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be
22
- * included in all copies or substantial portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
25
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
28
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
29
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
30
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
- */
32
-
33
- package nokogiri.internals;
34
-
35
- import org.jruby.javasupport.JavaUtil;
36
- import org.jruby.javasupport.util.RuntimeHelpers;
37
- import org.jruby.runtime.ThreadContext;
38
- import org.jruby.runtime.builtin.IRubyObject;
39
-
40
- import nokogiri.XsltStylesheet;
41
-
42
- /**
43
- * XSLT extension function caller. Currently, this class is not used because
44
- * parsing XSL file with extension function (written in Java) fails. The reason of
45
- * the failure is a conflict of Java APIs. When xercesImpl.jar or jing.jar, or both
46
- * are on a classpath, parsing fails. Assuming parsing passes, this class will be
47
- * used as in below:
48
- *
49
- * <xsl:stylesheet
50
- * xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
51
- * xmlns:f="xalan://nokogiri.internals.XsltExtensionFunction"
52
- * extension-element-prefixes="f"
53
- * version="1.0">
54
- * <xsl:template match="text()">
55
- * <xsl:copy-of select="f:call('capitalize', string(.))"/>
56
- * </xsl:template>
57
- * ...
58
- * </xsl:stylesheet>
59
- *
60
- * @author Yoko Harada <yokolet@gmail.com>
61
- */
62
- public class XsltExtensionFunction {
63
- public static Object call(String method, Object arg) {
64
- if (XsltStylesheet.getRegistry() == null) return null;
65
- ThreadContext context = (ThreadContext) XsltStylesheet.getRegistry().get("context");
66
- IRubyObject receiver = (IRubyObject)XsltStylesheet.getRegistry().get("receiver");
67
- if (context == null || receiver == null) return null;
68
- IRubyObject arg0 = JavaUtil.convertJavaToUsableRubyObject(context.getRuntime(), arg);
69
- IRubyObject result = RuntimeHelpers.invoke(context, receiver, method, arg0);
70
- return result.toJava(Object.class);
71
- }
72
- }
@@ -1,61 +0,0 @@
1
- {
2
- <insert_a_suppression_name_here>
3
- Memcheck:Addr8
4
- fun:garbage_collect
5
- fun:rb_newobj
6
- fun:rb_node_newnode
7
- fun:ruby_yyparse
8
- fun:yycompile
9
- fun:load_file
10
- fun:rb_load
11
- fun:rb_require_safe
12
- fun:rb_call0
13
- fun:rb_call
14
- fun:eval_fcall
15
- fun:rb_eval
16
- fun:rb_load
17
- fun:rb_require_safe
18
- fun:rb_call0
19
- fun:rb_call
20
- fun:eval_fcall
21
- fun:rb_eval
22
- fun:rb_load
23
- fun:rb_require_safe
24
- fun:rb_protect
25
- fun:require_libraries
26
- fun:proc_options
27
- fun:ruby_process_options
28
- }
29
- {
30
- <insert_a_suppression_name_here>
31
- Memcheck:Addr8
32
- fun:garbage_collect_0
33
- fun:rb_newobj
34
- fun:rb_node_newnode
35
- fun:ruby_yyparse
36
- fun:yycompile
37
- fun:load_file
38
- fun:rb_load
39
- fun:rb_require_safe
40
- fun:rb_call0
41
- fun:rb_call
42
- fun:eval_fcall
43
- fun:rb_eval
44
- fun:rb_load
45
- fun:rb_require_safe
46
- fun:rb_call0
47
- fun:rb_call
48
- fun:eval_fcall
49
- fun:rb_eval
50
- fun:rb_load
51
- fun:rb_require_safe
52
- fun:rb_protect
53
- fun:require_libraries
54
- fun:proc_options
55
- fun:ruby_process_options
56
- }
57
- {
58
- <insert_a_suppression_name_here>
59
- Memcheck:Addr8
60
- fun:rb_gc_wipe_stack
61
- }
File without changes
@@ -1,28 +0,0 @@
1
- {
2
- <insert_a_suppression_name_here>
3
- Memcheck:Addr4
4
- fun:glob_helper
5
- fun:ruby_glob0
6
- fun:rb_push_glob
7
- fun:vm_call_method
8
- fun:vm_exec_core
9
- fun:vm_exec
10
- fun:rb_yield
11
- fun:rb_ary_each
12
- fun:vm_call_method
13
- fun:vm_exec_core
14
- fun:vm_exec
15
- fun:vm_call0
16
- fun:rb_iterate
17
- fun:rb_block_call
18
- fun:enum_find_all
19
- fun:vm_call_method
20
- fun:vm_exec_core
21
- fun:vm_exec
22
- fun:vm_call0
23
- fun:rb_class_new_instance
24
- fun:vm_call_method
25
- fun:vm_exec_core
26
- fun:vm_exec
27
- fun:vm_call0
28
- }
@@ -1,28 +0,0 @@
1
- {
2
- <insert_a_suppression_name_here>
3
- Memcheck:Addr4
4
- fun:glob_helper
5
- fun:ruby_glob0
6
- fun:rb_push_glob
7
- fun:vm_call_method
8
- fun:vm_exec_core
9
- fun:vm_exec
10
- fun:rb_yield
11
- fun:rb_ary_each
12
- fun:vm_call_method
13
- fun:vm_exec_core
14
- fun:vm_exec
15
- fun:vm_call0
16
- fun:rb_iterate
17
- fun:rb_block_call
18
- fun:enum_find_all
19
- fun:vm_call_method
20
- fun:vm_exec_core
21
- fun:vm_exec
22
- fun:vm_call0
23
- fun:rb_class_new_instance
24
- fun:vm_call_method
25
- fun:vm_exec_core
26
- fun:vm_exec
27
- fun:vm_call0
28
- }
data/test_all DELETED
@@ -1,105 +0,0 @@
1
- #! /usr/bin/env bash
2
- #
3
- # script to run tests on all relevant rubies, and valgrind on supported rubies.
4
- # outputs tests to `test.log` and valgrind output to `valgrind.log`.
5
- #
6
- # requires `rvm` to be installed. sorry about that, multiruby dudes.
7
- #
8
- # it's worth periodically using hoe-debugger's ability to generate
9
- # valgrind suppression files to remove spurious valgrind messages
10
- # (e.g., 1.9.3's glob_helper). ["rake test:valgrind:suppression"]
11
- #
12
-
13
- # I'd add rubinius, but rvm errors when building it on my machine. :(
14
- RUBIES="\
15
- ruby-2.4 \
16
- ruby-2.3 \
17
- ruby-2.2 \
18
- ruby-2.1 \
19
- jruby-9.1.6.0 \
20
- jruby-1.7.19
21
- "
22
-
23
- TEST_LOG=test.log
24
- VALGRIND_LOG=valgrind.log
25
-
26
- # make sure we can test with libxml-ruby installed
27
- export BUNDLE_GEMFILE="$(pwd)/Gemfile_test_all"
28
- cat > $BUNDLE_GEMFILE <<EOF
29
- gem "libxml-ruby", :platform => :mri, :require => false
30
- eval_gemfile File.join(File.dirname(ENV['BUNDLE_GEMFILE']),"Gemfile")
31
- EOF
32
-
33
- # Load RVM into a shell session *as a function*
34
- if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
35
- source "$HOME/.rvm/scripts/rvm"
36
- elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
37
- source "/usr/local/rvm/scripts/rvm"
38
- else
39
- echo "ERROR: An RVM installation was not found.\n"
40
- fi
41
-
42
- > $TEST_LOG
43
- > $VALGRIND_LOG
44
- set -o errexit
45
-
46
- function rvm_use {
47
- current_ruby=$1
48
- rvm use "${1}@nokogiri" --create
49
- }
50
-
51
- function clean {
52
- bundle exec rake clean clobber 2>&1 > /dev/null
53
- }
54
-
55
- function compile {
56
- echo "** compiling ..."
57
- bundle exec rake compile 2>&1 > /dev/null
58
- }
59
-
60
- # quick check that we have All The Rubies
61
- for ruby in $RUBIES ; do
62
- rvm_use ${ruby}
63
- done
64
-
65
- for ruby in $RUBIES ; do
66
- rvm_use ${ruby}
67
- if ! [[ $(bundle -v) =~ "1.12." ]] ; then
68
- yes | gem uninstall --force bundler
69
- gem install bundler -v 1.12.5
70
- bundle -v
71
- fi
72
- bundle install --quiet --local || bundle install
73
- clean
74
- done
75
-
76
- for ruby in $RUBIES ; do
77
- rvm_use ${ruby}
78
- echo -e "**\n** testing nokogiri on ${ruby}\n**"
79
- clean
80
- compile
81
- echo "** running tests ..."
82
- bundle exec rake test 2>&1
83
- if [[ ! $ruby =~ "jruby" ]] ; then
84
- echo "** running tests again with libxml-ruby loaded ..."
85
- if ! gem list libxml-ruby | fgrep 2.8.0 ; then
86
- gem install libxml-ruby
87
- fi
88
- bundle exec rake test:libxml-ruby 2>&1
89
- fi
90
- clean
91
- done | tee -a $TEST_LOG
92
-
93
- for ruby in $RUBIES ; do
94
- if [[ ! $ruby =~ "jruby" ]] ; then
95
- rvm_use ${ruby}
96
- echo -e "**\n** nokogiri prerelease: ${ruby}\n**"
97
- clean
98
- compile
99
- echo "** running valgrind on tests ..."
100
- bundle exec rake test:valgrind 2>&1
101
- echo "** running valgrind again with libxml-ruby loaded ..."
102
- bundle exec rake test:valgrind:libxml-ruby 2>&1
103
- clean
104
- fi
105
- done | tee -a $VALGRIND_LOG