nokogiri 1.5.7 → 1.5.8

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.

@@ -1,4 +1,13 @@
1
1
 
2
+ === 1.5.8 / 2013年03月19日
3
+
4
+ * Bugfixes
5
+
6
+ * (JRuby) Fix EmptyStackException thrown by elements with xlink:href attributes and no base_uri #534, #805. (Thanks, Patrick Quinn and Brian Hoffman!)
7
+ * Fixes duplicate attributes issue introduced in 1.5.7. #865
8
+ * Allow use of a prefixed namespace on a root node using Nokogiri::XML::Builder #868
9
+
10
+
2
11
  === 1.5.7 / 2013年03月18日
3
12
 
4
13
  * Features
@@ -1,4 +1,13 @@
1
1
 
2
+ === 1.5.8 / 2013-03-19
3
+
4
+ * Bugfixes
5
+
6
+ * (JRuby) Fix EmptyStackException thrown by elements with xlink:href attributes and no base_uri #534, #805. (Thanks, Patrick Quinn and Brian Hoffman!)
7
+ * Fixes duplicate attributes issue introduced in 1.5.7. #865
8
+ * Allow use of a prefixed namespace on a root node using Nokogiri::XML::Builder #868
9
+
10
+
2
11
  === 1.5.7 / 2013-03-18
3
12
 
4
13
  * Features
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.5.7'
3
+ VERSION = '1.5.8'
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -318,7 +318,9 @@ module Nokogiri
318
318
  # Build a tag that is associated with namespace +ns+. Raises an
319
319
  # ArgumentError if +ns+ has not been defined higher in the tree.
320
320
  def [] ns
321
- @ns = @parent.namespace_definitions.find { |x| x.prefix == ns.to_s }
321
+ if @parent != @doc
322
+ @ns = @parent.namespace_definitions.find { |x| x.prefix == ns.to_s }
323
+ end
322
324
  return self if @ns
323
325
 
324
326
  @parent.ancestors.each do |a|
@@ -87,8 +87,9 @@ module Nokogiri
87
87
  if key =~ NCNAME_RE
88
88
  ns_name = key.split(":", 2)[1]
89
89
  elm.add_namespace_definition ns_name, v
90
+ else
91
+ elm[k.to_s] = v.to_s
90
92
  end
91
- elm[k.to_s] = v.to_s
92
93
  }
93
94
  else
94
95
  elm.content = arg
@@ -0,0 +1,14 @@
1
+ require "helper"
2
+
3
+ module Nokogiri
4
+ module XML
5
+ class TestAdditionalNamespacesInBuilderDoc < Nokogiri::TestCase
6
+ def test_builder_namespaced_root_node_ns
7
+ b = Nokogiri::XML::Builder.new do |x|
8
+ x[:foo].RDF(:'xmlns:foo' => 'http://foo.io')
9
+ end
10
+ assert_equal 'http://foo.io', b.doc.root.namespace.href
11
+ end
12
+ end
13
+ end
14
+ end
@@ -55,6 +55,12 @@ module Nokogiri
55
55
  def test_builder_buried_decl_ns
56
56
  assert_equal 'ns:veg', check_namespace(@doc.root.elements[3].elements[1])
57
57
  end
58
+ def test_builder_namespace_count
59
+ n = @doc.root.clone
60
+ n.children.each(&:remove)
61
+ ns_attrs = n.to_xml.scan(/\bxmlns(?::.+?)?=/)
62
+ assert_equal 3, ns_attrs.length
63
+ end
58
64
  end
59
65
  end
60
66
  end
@@ -57,6 +57,12 @@ module Nokogiri
57
57
  def test_created_buried_decl_ns
58
58
  assert_equal 'ns:veg', check_namespace(@doc.root.elements[3].elements[1])
59
59
  end
60
+ def test_created_namespace_count
61
+ n = @doc.root.clone
62
+ n.children.each(&:remove)
63
+ ns_attrs = n.to_xml.scan(/\bxmlns(?::.+?)?=/)
64
+ assert_equal 3, ns_attrs.length
65
+ end
60
66
  end
61
67
  end
62
68
  end
@@ -55,6 +55,12 @@ module Nokogiri
55
55
  def test_parsed_buried_decl_ns
56
56
  assert_equal 'ns:veg', check_namespace(@doc.root.elements[3].elements[1])
57
57
  end
58
+ def test_parsed_namespace_count
59
+ n = @doc.root.clone
60
+ n.children.each(&:remove)
61
+ ns_attrs = n.to_xml.scan(/\bxmlns(?::.+?)?=/)
62
+ assert_equal 3, ns_attrs.length
63
+ end
58
64
  end
59
65
  end
60
66
  end
@@ -433,6 +433,39 @@ class TestReader < Nokogiri::TestCase
433
433
  reader.map {|n| n.base_uri })
434
434
  end
435
435
 
436
+ def test_xlink_href_without_base_uri
437
+ reader = Nokogiri::XML::Reader(<<-eoxml)
438
+ <x xmlns:xlink="http://www.w3.org/1999/xlink">
439
+ <link xlink:href="#other">Link</link>
440
+ <other id="other">Linked Element</other>
441
+ </x>
442
+ eoxml
443
+
444
+ reader.each do |node|
445
+ if node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
446
+ if node.name == 'link'
447
+ assert_nil node.base_uri
448
+ end
449
+ end
450
+ end
451
+ end
452
+
453
+ def test_xlink_href_with_base_uri
454
+ reader = Nokogiri::XML::Reader(<<-eoxml)
455
+ <x xml:base="http://base.example.org/base/"
456
+ xmlns:xlink="http://www.w3.org/1999/xlink">
457
+ <link xlink:href="#other">Link</link>
458
+ <other id="other">Linked Element</other>
459
+ </x>
460
+ eoxml
461
+
462
+ reader.each do |node|
463
+ if node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
464
+ assert_equal node.base_uri, "http://base.example.org/base/"
465
+ end
466
+ end
467
+ end
468
+
436
469
  def test_read_from_memory
437
470
  called = false
438
471
  reader = Nokogiri::XML::Reader.from_memory('<foo>bar</foo>')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 7
10
- version: 1.5.7
9
+ - 8
10
+ version: 1.5.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aaron Patterson
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2013-03-18 00:00:00 Z
21
+ date: 2013-03-19 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  prerelease: false
@@ -502,6 +502,7 @@ files:
502
502
  - test_all
503
503
  - test/namespaces/test_namespaces_in_builder_doc.rb
504
504
  - test/namespaces/test_namespaces_in_created_doc.rb
505
+ - test/namespaces/test_additional_namespaces_in_builder_doc.rb
505
506
  - test/namespaces/test_namespaces_in_parsed_doc.rb
506
507
  homepage: http://nokogiri.org
507
508
  licenses: []
@@ -602,6 +603,7 @@ test_files:
602
603
  - test/test_convert_xpath.rb
603
604
  - test/namespaces/test_namespaces_in_builder_doc.rb
604
605
  - test/namespaces/test_namespaces_in_created_doc.rb
606
+ - test/namespaces/test_additional_namespaces_in_builder_doc.rb
605
607
  - test/namespaces/test_namespaces_in_parsed_doc.rb
606
608
  - test/test_xslt_transforms.rb
607
609
  - test/test_nokogiri.rb