nokogiri 1.6.5-java → 1.6.6.1-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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +5 -0
  3. data/.travis.yml +10 -20
  4. data/CHANGELOG.ja.rdoc +28 -1
  5. data/CHANGELOG.rdoc +28 -1
  6. data/Gemfile +1 -1
  7. data/Manifest.txt +5 -1
  8. data/README.ja.rdoc +10 -9
  9. data/README.rdoc +6 -9
  10. data/ROADMAP.md +15 -3
  11. data/Rakefile +1 -3
  12. data/bin/nokogiri +48 -8
  13. data/ext/java/nokogiri/HtmlSaxParserContext.java +1 -1
  14. data/ext/java/nokogiri/HtmlSaxPushParser.java +244 -0
  15. data/ext/java/nokogiri/NokogiriService.java +9 -0
  16. data/ext/java/nokogiri/XmlComment.java +2 -0
  17. data/ext/java/nokogiri/XmlNode.java +57 -30
  18. data/ext/java/nokogiri/XmlSyntaxError.java +11 -9
  19. data/ext/nokogiri/extconf.rb +18 -3
  20. data/ext/nokogiri/xml_comment.c +17 -2
  21. data/ext/nokogiri/xml_node.c +66 -6
  22. data/ext/nokogiri/xml_syntax_error.c +4 -0
  23. data/ext/nokogiri/xml_syntax_error.h +1 -0
  24. data/lib/nokogiri.rb +2 -2
  25. data/lib/nokogiri/decorators/slop.rb +7 -8
  26. data/lib/nokogiri/html/document_fragment.rb +0 -2
  27. data/lib/nokogiri/html/sax/push_parser.rb +22 -2
  28. data/lib/nokogiri/nokogiri.jar +0 -0
  29. data/lib/nokogiri/version.rb +1 -1
  30. data/lib/nokogiri/xml.rb +1 -0
  31. data/lib/nokogiri/xml/document.rb +4 -4
  32. data/lib/nokogiri/xml/document_fragment.rb +39 -2
  33. data/lib/nokogiri/xml/node.rb +11 -181
  34. data/lib/nokogiri/xml/node_set.rb +41 -85
  35. data/lib/nokogiri/xml/searchable.rb +221 -0
  36. data/ports/patches/sort-patches-by-date +25 -0
  37. data/test/css/test_nthiness.rb +1 -1
  38. data/test/html/sax/test_push_parser.rb +87 -0
  39. data/test/html/test_document.rb +20 -5
  40. data/test/html/test_document_fragment.rb +25 -0
  41. data/test/xml/test_attr.rb +5 -2
  42. data/test/xml/test_builder.rb +27 -1
  43. data/test/xml/test_comment.rb +11 -0
  44. data/test/xml/test_document.rb +34 -0
  45. data/test/xml/test_document_fragment.rb +40 -9
  46. data/test/xml/test_namespace.rb +1 -0
  47. data/test/xml/test_node.rb +37 -1
  48. data/test/xml/test_node_set.rb +56 -36
  49. data/test/xml/test_xpath.rb +65 -19
  50. data/test_all +11 -1
  51. metadata +12 -7
  52. data/tasks/nokogiri.org.rb +0 -24
@@ -13,12 +13,6 @@ module Nokogiri
13
13
  # functions to be in a namespace. This is not required by XPath, afaik,
14
14
  # but it is an usual convention though.
15
15
  #
16
- # Furthermore, CSS does not support extension functions but it does in
17
- # Nokogiri. Result: you cannot use them in JRuby impl. At least, until
18
- # the CSS to XPath parser is patched, and let me say that there are more
19
- # important features to add before that happens. I hope you will forgive
20
- # me.
21
- #
22
16
  # Yours truly,
23
17
  #
24
18
  # The guy whose headaches belong to Nokogiri JRuby impl.
@@ -69,6 +63,10 @@ module Nokogiri
69
63
  assert_equal 4, @xml.xpath('//address[@domestic=$value]', nil, :value => 'Yes').length
70
64
  end
71
65
 
66
+ def test_variable_binding_with_search
67
+ assert_equal 4, @xml.search('//address[@domestic=$value]', nil, :value => 'Yes').length
68
+ end
69
+
72
70
  def test_unknown_attribute
73
71
  assert_equal 0, @xml.xpath('//employee[@id="asdfasdf"]/@fooo').length
74
72
  assert_nil @xml.xpath('//employee[@id="asdfasdf"]/@fooo')[0]
@@ -86,12 +84,28 @@ module Nokogiri
86
84
  assert_equal 'foo', @xml.xpath('concat("fo", "o")')
87
85
  end
88
86
 
87
+ def test_node_search_with_multiple_queries
88
+ xml = '<document>
89
+ <thing>
90
+ <div class="title">important thing</div>
91
+ </thing>
92
+ <thing>
93
+ <div class="content">stuff</div>
94
+ </thing>
95
+ <thing>
96
+ <p class="blah">more stuff</div>
97
+ </thing>
98
+ </document>'
99
+ node = Nokogiri::XML(xml).root
100
+ assert_kind_of Nokogiri::XML::Node, node
101
+
102
+ assert_equal 3, node.xpath('.//div', './/p').length
103
+ assert_equal 3, node.css('.title', '.content', 'p').length
104
+ assert_equal 3, node.search('.//div', 'p.blah').length
105
+ end
106
+
89
107
  def test_css_search_uses_custom_selectors_with_arguments
90
- set = if Nokogiri.uses_libxml?
91
- @xml.css('employee > address:my_filter("domestic", "Yes")', @handler)
92
- else
93
- @xml.xpath("//employee/address[nokogiri:my_filter(., \"domestic\", \"Yes\")]", @ns, @handler)
94
- end
108
+ set = @xml.css('employee > address:my_filter("domestic", "Yes")', @handler)
95
109
  assert set.length > 0
96
110
  set.each do |node|
97
111
  assert_equal 'Yes', node['domestic']
@@ -100,15 +114,31 @@ module Nokogiri
100
114
 
101
115
  def test_css_search_uses_custom_selectors
102
116
  set = @xml.xpath('//employee')
103
- if Nokogiri.uses_libxml?
104
- @xml.css('employee:thing()', @handler)
105
- else
106
- @xml.xpath("//employee[nokogiri:thing(.)]", @ns, @handler)
107
- end
117
+ @xml.css('employee:thing()', @handler)
108
118
  assert_equal(set.length, @handler.things.length)
109
119
  assert_equal(set.to_a, @handler.things.flatten)
110
120
  end
111
121
 
122
+ def test_search_with_css_query_uses_custom_selectors_with_arguments
123
+ set = @xml.search('employee > address:my_filter("domestic", "Yes")', @handler)
124
+ assert set.length > 0
125
+ set.each do |node|
126
+ assert_equal 'Yes', node['domestic']
127
+ end
128
+ end
129
+
130
+ def test_search_with_xpath_query_uses_custom_selectors_with_arguments
131
+ set = if Nokogiri.uses_libxml?
132
+ @xml.search('//employee/address[my_filter(., "domestic", "Yes")]', @handler)
133
+ else
134
+ @xml.search('//employee/address[nokogiri:my_filter(., "domestic", "Yes")]', @ns, @handler)
135
+ end
136
+ assert set.length > 0
137
+ set.each do |node|
138
+ assert_equal 'Yes', node['domestic']
139
+ end
140
+ end
141
+
112
142
  def test_pass_self_to_function
113
143
  set = if Nokogiri.uses_libxml?
114
144
  @xml.xpath('//employee/address[my_filter(., "domestic", "Yes")]', @handler)
@@ -179,6 +209,22 @@ module Nokogiri
179
209
  assert_send [elapsed_time, :<, time_limit], "XPath is taking too long"
180
210
  end
181
211
 
212
+ # issue #1109 (jruby impl's xpath() cache not being cleared on attr removal)
213
+ def test_xpath_results_cache_should_get_cleared_on_attr_removal
214
+ doc = Nokogiri::HTML('<html><div name="foo"></div></html>')
215
+ element = doc.at_xpath('//div[@name="foo"]')
216
+ element.remove_attribute('name')
217
+ assert_nil doc.at_xpath('//div[@name="foo"]')
218
+ end
219
+
220
+ # issue #1109 (jruby impl's xpath() cache not being cleared on attr update )
221
+ def test_xpath_results_cache_should_get_cleared_on_attr_update
222
+ doc = Nokogiri::HTML('<html><div name="foo"></div></html>')
223
+ element = doc.at_xpath('//div[@name="foo"]')
224
+ element['name'] = 'bar'
225
+ assert_nil doc.at_xpath('//div[@name="foo"]')
226
+ end
227
+
182
228
  def test_custom_xpath_function_returns_string
183
229
  if Nokogiri.uses_libxml?
184
230
  result = @xml.xpath('thing("asdf")', @handler)
@@ -332,7 +378,7 @@ END
332
378
  <RecordReference>a</RecordReference>
333
379
  </Product>
334
380
  </ONIXMessage>}
335
-
381
+
336
382
  xml_doc = Nokogiri::XML(xml_string)
337
383
  onix = xml_doc.children.first
338
384
  assert_equal 'a', onix.at_xpath('xmlns:Product').at_xpath('xmlns:RecordReference').text
@@ -350,7 +396,7 @@ END
350
396
  <title>Artikkelin otsikko Hydrangea artiklan 1</title>
351
397
  </titleInfo>
352
398
  </mods>}
353
-
399
+
354
400
  xml_doc = Nokogiri::XML(xml_string)
355
401
  ns_hash = {'mods'=>'http://www.loc.gov/mods/v3'}
356
402
  node = xml_doc.at_xpath('//mods:titleInfo[1]',ns_hash)
@@ -371,7 +417,7 @@ END
371
417
  <title>Artikkelin otsikko Hydrangea artiklan 1</title>
372
418
  </titleInfo>
373
419
  </mods>}
374
-
420
+
375
421
  xml_doc = Nokogiri::XML(xml_string)
376
422
  ns_hash = {'mods'=>'http://www.loc.gov/mods/v3'}
377
423
  node = xml_doc.at_xpath('//mods:titleInfo[1]',ns_hash)
data/test_all CHANGED
@@ -10,7 +10,17 @@
10
10
  # (e.g., 1.9.3's glob_helper). ["rake test:valgrind:suppression"]
11
11
  #
12
12
 
13
- RUBIES="ruby-2.2.0-preview1 ruby-2.1 ruby-2.0.0-p481 ruby-1.9.3 jruby-1.7.15"
13
+ # I'd add rubinius, but rvm errors when building it on my machine. :(
14
+ RUBIES="\
15
+ ruby-2.2 \
16
+ ruby-2.1 \
17
+ ruby-2.0.0-p598 \
18
+ ruby-1.9.3-p551 \
19
+ ruby-1.9.2-p330 \
20
+ jruby-9.0.0.0.pre1 \
21
+ jruby-1.7.18
22
+ "
23
+
14
24
  TEST_LOG=test.log
15
25
  VALGRIND_LOG=valgrind.log
16
26
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.5
4
+ version: 1.6.6.1
5
5
  platform: java
6
6
  authors:
7
7
  - Aaron Patterson
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-11-26 00:00:00.000000000 Z
15
+ date: 2015-01-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rdoc
@@ -46,14 +46,14 @@ dependencies:
46
46
  name: hoe-debugging
47
47
  version_requirements: !ruby/object:Gem::Requirement
48
48
  requirements:
49
- - - '>='
49
+ - - ~>
50
50
  - !ruby/object:Gem::Version
51
- version: 1.0.3
51
+ version: 1.2.0
52
52
  requirement: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ~>
55
55
  - !ruby/object:Gem::Version
56
- version: 1.0.3
56
+ version: 1.2.0
57
57
  prerelease: false
58
58
  type: :development
59
59
  - !ruby/object:Gem::Dependency
@@ -230,6 +230,7 @@ extra_rdoc_files:
230
230
  - ext/nokogiri/xslt_stylesheet.c
231
231
  files:
232
232
  - .autotest
233
+ - .cross_rubies
233
234
  - .editorconfig
234
235
  - .gemtest
235
236
  - .travis.yml
@@ -252,6 +253,7 @@ files:
252
253
  - ext/java/nokogiri/HtmlElementDescription.java
253
254
  - ext/java/nokogiri/HtmlEntityLookup.java
254
255
  - ext/java/nokogiri/HtmlSaxParserContext.java
256
+ - ext/java/nokogiri/HtmlSaxPushParser.java
255
257
  - ext/java/nokogiri/NokogiriService.java
256
258
  - ext/java/nokogiri/XmlAttr.java
257
259
  - ext/java/nokogiri/XmlAttributeDecl.java
@@ -461,6 +463,7 @@ files:
461
463
  - lib/nokogiri/xml/sax/parser_context.rb
462
464
  - lib/nokogiri/xml/sax/push_parser.rb
463
465
  - lib/nokogiri/xml/schema.rb
466
+ - lib/nokogiri/xml/searchable.rb
464
467
  - lib/nokogiri/xml/syntax_error.rb
465
468
  - lib/nokogiri/xml/text.rb
466
469
  - lib/nokogiri/xml/xpath.rb
@@ -484,12 +487,12 @@ files:
484
487
  - ports/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
485
488
  - ports/patches/libxslt/0014-Fix-for-bug-436589.patch
486
489
  - ports/patches/libxslt/0015-Fix-mkdir-for-mingw.patch
490
+ - ports/patches/sort-patches-by-date
487
491
  - suppressions/README.txt
488
492
  - suppressions/nokogiri_ree-1.8.7.358.supp
489
493
  - suppressions/nokogiri_ruby-1.8.7.370.supp
490
494
  - suppressions/nokogiri_ruby-1.9.2.320.supp
491
495
  - suppressions/nokogiri_ruby-1.9.3.327.supp
492
- - tasks/nokogiri.org.rb
493
496
  - tasks/test.rb
494
497
  - test/css/test_nthiness.rb
495
498
  - test/css/test_parser.rb
@@ -534,6 +537,7 @@ files:
534
537
  - test/helper.rb
535
538
  - test/html/sax/test_parser.rb
536
539
  - test/html/sax/test_parser_context.rb
540
+ - test/html/sax/test_push_parser.rb
537
541
  - test/html/test_builder.rb
538
542
  - test/html/test_document.rb
539
543
  - test/html/test_document_encoding.rb
@@ -684,6 +688,7 @@ test_files:
684
688
  - test/html/test_node_encoding.rb
685
689
  - test/html/sax/test_parser_context.rb
686
690
  - test/html/sax/test_parser.rb
691
+ - test/html/sax/test_push_parser.rb
687
692
  - test/xslt/test_custom_functions.rb
688
693
  - test/xslt/test_exception_handling.rb
689
694
  - test/decorators/test_slop.rb
@@ -1,24 +0,0 @@
1
- #
2
- # note that this file will only work if you've got the `nokogiri.org`
3
- # repo checked out, and you've got an rvm gemset "1.8.7@nokogiri"
4
- # bundled with both nokogiri's and nokogiri.org's gems.
5
- #
6
- namespace :docs do
7
- desc "generate HTML docs for nokogiri.org"
8
- task :website do
9
- system 'rvm use 1.8.7@nokogiri' # see above
10
- title = "#{HOE.name}-#{HOE.version} Documentation"
11
-
12
- options = []
13
- options << "--main=#{HOE.readme_file}"
14
- options << '--format=activerecord'
15
- options << '--threads=1'
16
- options << "--title=#{title.inspect}"
17
-
18
- options += HOE.spec.require_paths
19
- options += HOE.spec.extra_rdoc_files
20
- require 'rdoc/rdoc'
21
- ENV['RAILS_ROOT'] ||= File.expand_path(File.join('..', 'nokogiri_ws'))
22
- RDoc::RDoc.new.document options
23
- end
24
- end