nokogiri 1.5.5.rc2-x86-mswin32-60 → 1.5.5.rc3-x86-mswin32-60
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.
- data/CHANGELOG.ja.rdoc +1 -0
- data/CHANGELOG.rdoc +1 -0
- data/README.ja.rdoc +5 -5
- data/README.rdoc +9 -9
- data/ROADMAP.md +20 -20
- data/Rakefile +5 -0
- data/Y_U_NO_GEMSPEC.md +3 -3
- data/ext/nokogiri/xml_node.c +2 -2
- data/lib/nokogiri/1.8/nokogiri.so +0 -0
- data/lib/nokogiri/1.9/nokogiri.so +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/node/save_options.rb +1 -1
- data/test/html/test_document.rb +2 -2
- data/test/xml/test_document.rb +1 -1
- data/test/xml/test_dtd.rb +3 -7
- data/test/xml/test_entity_reference.rb +214 -0
- data/test/xml/test_node_reparenting.rb +1 -1
- data/test/xml/test_xpath.rb +1 -1
- metadata +4 -4
data/CHANGELOG.ja.rdoc
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
* JRuby で xpath を namespace 付きで指定した場合に、エラーが発生する。pull request #681 (ありがとう, Piotr Szmielew)
|
15
15
|
* JRuby で Nokogiri::XML::Node を継承したクラスを定義すると、namespace が表示されない。 #695
|
16
16
|
* JRuby で RDF::RDFXML::Writer をインスタンス化しようとすると NAMESPACE_ERR (org.w3c.dom.DOMException) が発生する. #683
|
17
|
+
* JRuby で xpath に namespaces を指定すると例外が発生する. #493
|
17
18
|
|
18
19
|
|
19
20
|
== 1.5.4 / 2012年6月12日
|
data/CHANGELOG.rdoc
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
* JRuby raises exception when xpath with namespace is specified. pull request #681 (Thanks, Piotr Szmielew)
|
15
15
|
* JRuby renders nodes without their namespace when subclassing Node. #695
|
16
16
|
* JRuby raises NAMESPACE_ERR (org.w3c.dom.DOMException) while instantiating RDF::RDFXML::Writer. #683
|
17
|
+
* JRuby is not able to use namespaces in xpath. #493
|
17
18
|
|
18
19
|
|
19
20
|
== 1.5.4 / 2012-06-12
|
data/README.ja.rdoc
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
= Nokogiri (鋸)
|
2
2
|
|
3
3
|
* http://nokogiri.org/
|
4
|
-
* http://github.com/
|
5
|
-
* http://github.com/
|
4
|
+
* http://github.com/sparklemotion/nokogiri/wikis
|
5
|
+
* http://github.com/sparklemotion/nokogiri/tree/master
|
6
6
|
* http://groups.google.com/group/nokogiri-list
|
7
|
-
* http://github.com/
|
7
|
+
* http://github.com/sparklemotion/nokogiri/issues
|
8
8
|
|
9
9
|
== DESCRIPTION:
|
10
10
|
|
@@ -29,9 +29,9 @@ XML/HTMLの高速な解析と探索検索、ならびにCSS3セレクタとXPath
|
|
29
29
|
|
30
30
|
* http://groups.google.com/group/nokogiri-list
|
31
31
|
|
32
|
-
{バグ報告}[http://github.com/
|
32
|
+
{バグ報告}[http://github.com/sparklemotion/nokogiri/issues]
|
33
33
|
|
34
|
-
* http://github.com/
|
34
|
+
* http://github.com/sparklemotion/nokogiri/issues
|
35
35
|
|
36
36
|
IRCのチャンネルはfreenodeの #nokogiri です。
|
37
37
|
|
data/README.rdoc
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
= Nokogiri {<img src="https://secure.travis-ci.org/
|
1
|
+
= Nokogiri {<img src="https://secure.travis-ci.org/sparklemotion/nokogiri.png?rvm=1.9.3" />}[http://travis-ci.org/sparklemotion/nokogiri]
|
2
2
|
|
3
3
|
* http://nokogiri.org
|
4
|
-
* http://github.com/
|
5
|
-
* http://github.com/
|
4
|
+
* http://github.com/sparklemotion/nokogiri/wikis
|
5
|
+
* http://github.com/sparklemotion/nokogiri/tree/master
|
6
6
|
* http://groups.google.com/group/nokogiri-talk
|
7
|
-
* http://github.com/
|
7
|
+
* http://github.com/sparklemotion/nokogiri/issues
|
8
8
|
|
9
9
|
== DESCRIPTION:
|
10
10
|
|
@@ -34,10 +34,10 @@ is available here:
|
|
34
34
|
|
35
35
|
* http://groups.google.com/group/nokogiri-talk
|
36
36
|
|
37
|
-
The {bug tracker}[http://github.com/
|
37
|
+
The {bug tracker}[http://github.com/sparklemotion/nokogiri/issues]
|
38
38
|
is available here:
|
39
39
|
|
40
|
-
* http://github.com/
|
40
|
+
* http://github.com/sparklemotion/nokogiri/issues
|
41
41
|
|
42
42
|
The IRC channel is #nokogiri on freenode.
|
43
43
|
|
@@ -46,9 +46,9 @@ The IRC channel is #nokogiri on freenode.
|
|
46
46
|
require 'nokogiri'
|
47
47
|
require 'open-uri'
|
48
48
|
|
49
|
-
# Get a Nokogiri::HTML
|
49
|
+
# Get a Nokogiri::HTML::Document for the page we’re interested in...
|
50
50
|
|
51
|
-
doc = Nokogiri::HTML(open('http://www.google.com/search?q=
|
51
|
+
doc = Nokogiri::HTML(open('http://www.google.com/search?q=sparklemotion'))
|
52
52
|
|
53
53
|
# Do funky things with it using Nokogiri::XML::Node methods...
|
54
54
|
|
@@ -151,7 +151,7 @@ Then run rake:
|
|
151
151
|
|
152
152
|
Copyright (c) 2008 - 2012:
|
153
153
|
|
154
|
-
* {Aaron Patterson}[http://
|
154
|
+
* {Aaron Patterson}[http://sparklemotionmaking.com]
|
155
155
|
* {Mike Dalessio}[http://mike.daless.io]
|
156
156
|
* {Charles Nutter}[http://blog.headius.com]
|
157
157
|
* {Sergio Arbeo}[http://www.serabe.com]
|
data/ROADMAP.md
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
## overhaul serialize/pretty printing API
|
4
4
|
|
5
|
-
* https://github.com/
|
5
|
+
* https://github.com/sparklemotion/nokogiri/issues/530
|
6
6
|
XHTML formatting can't be turned off
|
7
7
|
|
8
|
-
* https://github.com/
|
8
|
+
* https://github.com/sparklemotion/nokogiri/issues/415
|
9
9
|
XML formatting should be no formatting
|
10
10
|
|
11
11
|
|
@@ -16,35 +16,35 @@
|
|
16
16
|
|
17
17
|
## Node should not be Enumerable; and should have a better attributes API
|
18
18
|
|
19
|
-
* https://github.com/
|
19
|
+
* https://github.com/sparklemotion/nokogiri/issues/679
|
20
20
|
Mixing in Enumerable has some unintended consequences; plus we want to improve the attributes API
|
21
21
|
|
22
|
-
* (closed) https://github.com/
|
22
|
+
* (closed) https://github.com/sparklemotion/nokogiri/issues/666
|
23
23
|
Some ideas for a better attributes API?
|
24
24
|
|
25
25
|
|
26
26
|
## improve CSS query parsing
|
27
27
|
|
28
|
-
* https://github.com/
|
28
|
+
* https://github.com/sparklemotion/nokogiri/issues/528
|
29
29
|
support `:not()` with a nontrivial argument, like `:not(div p.c)`
|
30
30
|
|
31
|
-
* https://github.com/
|
31
|
+
* https://github.com/sparklemotion/nokogiri/issues/451
|
32
32
|
chained :not pseudoselectors
|
33
33
|
|
34
34
|
* better jQuery selector support:
|
35
|
-
* https://github.com/
|
36
|
-
* https://github.com/
|
37
|
-
* https://github.com/
|
38
|
-
* https://github.com/
|
39
|
-
* https://github.com/
|
35
|
+
* https://github.com/sparklemotion/nokogiri/issues/621
|
36
|
+
* https://github.com/sparklemotion/nokogiri/issues/342
|
37
|
+
* https://github.com/sparklemotion/nokogiri/issues/628
|
38
|
+
* https://github.com/sparklemotion/nokogiri/issues/652
|
39
|
+
* https://github.com/sparklemotion/nokogiri/issues/688
|
40
40
|
|
41
|
-
* https://github.com/
|
41
|
+
* https://github.com/sparklemotion/nokogiri/issues/394
|
42
42
|
nth-of-type is wrong, and possibly other selectors as well
|
43
43
|
|
44
|
-
* https://github.com/
|
44
|
+
* https://github.com/sparklemotion/nokogiri/issues/309
|
45
45
|
incorrect query being executed
|
46
46
|
|
47
|
-
* https://github.com/
|
47
|
+
* https://github.com/sparklemotion/nokogiri/issues/350
|
48
48
|
:has is wrong?
|
49
49
|
|
50
50
|
|
@@ -52,15 +52,15 @@
|
|
52
52
|
|
53
53
|
* there are a few tickets about searches not working properly if you
|
54
54
|
use or do not use the context node as part of the search.
|
55
|
-
- https://github.com/
|
56
|
-
- https://github.com/
|
57
|
-
- https://github.com/
|
58
|
-
- https://github.com/
|
55
|
+
- https://github.com/sparklemotion/nokogiri/issues/213
|
56
|
+
- https://github.com/sparklemotion/nokogiri/issues/370
|
57
|
+
- https://github.com/sparklemotion/nokogiri/issues/454
|
58
|
+
- https://github.com/sparklemotion/nokogiri/issues/572
|
59
59
|
|
60
60
|
|
61
61
|
## Better Syntax for custom XPath function handler
|
62
62
|
|
63
|
-
* https://github.com/
|
63
|
+
* https://github.com/sparklemotion/nokogiri/pull/464
|
64
64
|
|
65
65
|
|
66
66
|
## Better Syntax around Node#xpath and NodeSet#xpath
|
@@ -68,7 +68,7 @@
|
|
68
68
|
* look at those methods, and use of Node#extract_params in Node#{css,search}
|
69
69
|
* we should standardize on a hash of options for these and other calls
|
70
70
|
* what should NodeSet#xpath return?
|
71
|
-
* https://github.com/
|
71
|
+
* https://github.com/sparklemotion/nokogiri/issues/656
|
72
72
|
|
73
73
|
## Encoding
|
74
74
|
|
data/Rakefile
CHANGED
@@ -145,7 +145,12 @@ end
|
|
145
145
|
|
146
146
|
require 'tasks/test'
|
147
147
|
|
148
|
+
task :java_debug do
|
149
|
+
ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if java? && ENV['JAVA_DEBUG']
|
150
|
+
end
|
151
|
+
|
148
152
|
Rake::Task[:test].prerequisites << :compile
|
153
|
+
Rake::Task[:test].prerequisites << :java_debug
|
149
154
|
Rake::Task[:test].prerequisites << :check_extra_deps unless java?
|
150
155
|
if Hoe.plugins.include?(:debugging)
|
151
156
|
['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
|
data/Y_U_NO_GEMSPEC.md
CHANGED
@@ -16,9 +16,9 @@ OHAI! Thank you for asking this question!
|
|
16
16
|
Team Nokogiri gets asked this pretty frequently. Just a sample from
|
17
17
|
the historical record:
|
18
18
|
|
19
|
-
* [Issue #274](https://github.com/
|
20
|
-
* [Issue #371](https://github.com/
|
21
|
-
* [A commit removing nokogiri.gemspec](https://github.com/
|
19
|
+
* [Issue #274](https://github.com/sparklemotion/nokogiri/issues/274)
|
20
|
+
* [Issue #371](https://github.com/sparklemotion/nokogiri/issues/371)
|
21
|
+
* [A commit removing nokogiri.gemspec](https://github.com/sparklemotion/nokogiri/commit/7f17a643a05ca381d65131515b54d4a3a61ca2e1#commitcomment-667477)
|
22
22
|
* [A nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/4706b002e492d23f)
|
23
23
|
* [Another nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/0b201bb80ea3eea0)
|
24
24
|
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -1329,8 +1329,8 @@ VALUE Nokogiri_wrap_xml_node(VALUE klass, xmlNodePtr node)
|
|
1329
1329
|
return DOC_RUBY_OBJECT(node->doc);
|
1330
1330
|
|
1331
1331
|
/* It's OK if the node doesn't have a fully-realized document (as in XML::Reader). */
|
1332
|
-
/* see https://github.com/
|
1333
|
-
/* and https://github.com/
|
1332
|
+
/* see https://github.com/sparklemotion/nokogiri/issues/95 */
|
1333
|
+
/* and https://github.com/sparklemotion/nokogiri/issues/439 */
|
1334
1334
|
doc = node->doc;
|
1335
1335
|
if (doc->type == XML_DOCUMENT_FRAG_NODE) doc = doc->doc;
|
1336
1336
|
node_has_a_document = DOC_RUBY_OBJECT_TEST(doc);
|
Binary file
|
Binary file
|
data/lib/nokogiri/version.rb
CHANGED
@@ -23,7 +23,7 @@ module Nokogiri
|
|
23
23
|
# Save builder created document
|
24
24
|
AS_BUILDER = 128
|
25
25
|
# the default for XML documents
|
26
|
-
DEFAULT_XML = AS_XML # https://github.com/
|
26
|
+
DEFAULT_XML = AS_XML # https://github.com/sparklemotion/nokogiri/issues/#issue/415
|
27
27
|
# the default for HTML document
|
28
28
|
DEFAULT_HTML = NO_DECLARATION | NO_EMPTY_TAGS | AS_HTML
|
29
29
|
else
|
data/test/html/test_document.rb
CHANGED
@@ -89,11 +89,11 @@ module Nokogiri
|
|
89
89
|
require 'open-uri'
|
90
90
|
begin
|
91
91
|
html = open('http://google.com').read
|
92
|
-
doc = Nokogiri::HTML html ,"/foo/", nil
|
93
|
-
refute_empty doc.to_s, "Document should not be empty"
|
94
92
|
rescue
|
95
93
|
skip("This test needs the internet. Skips if no internet available.")
|
96
94
|
end
|
95
|
+
doc = Nokogiri::HTML html ,"http:/foobar.foobar/"
|
96
|
+
refute_empty doc.to_s, "Document should not be empty"
|
97
97
|
end
|
98
98
|
|
99
99
|
###
|
data/test/xml/test_document.rb
CHANGED
data/test/xml/test_dtd.rb
CHANGED
@@ -14,12 +14,8 @@ module Nokogiri
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_external_id
|
17
|
-
|
18
|
-
|
19
|
-
else
|
20
|
-
xml = Nokogiri::XML('<!DOCTYPE foo PUBLIC "bar" ""><foo />')
|
21
|
-
end
|
22
|
-
assert dtd = xml.internal_subset
|
17
|
+
xml = Nokogiri::XML('<!DOCTYPE foo PUBLIC "bar" ""><foo />')
|
18
|
+
assert dtd = xml.internal_subset, 'no internal subset'
|
23
19
|
assert_equal 'bar', dtd.external_id
|
24
20
|
end
|
25
21
|
|
@@ -74,7 +70,7 @@ module Nokogiri
|
|
74
70
|
else
|
75
71
|
xml = Nokogiri::XML(File.open(XML_FILE)) {|cfg| cfg.dtdvalid}
|
76
72
|
list = xml.internal_subset.validate xml
|
77
|
-
assert_equal
|
73
|
+
assert_equal 40, list.length
|
78
74
|
end
|
79
75
|
end
|
80
76
|
|
@@ -17,5 +17,219 @@ module Nokogiri
|
|
17
17
|
100.times { EntityReference.new(@xml, 'foo') }
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
module Common
|
22
|
+
PATH = 'test/files/test_document_url/'
|
23
|
+
|
24
|
+
attr_accessor :path, :parser
|
25
|
+
|
26
|
+
def xml_document
|
27
|
+
File.join path, 'document.xml'
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.included base
|
31
|
+
def base.test_relative_and_absolute_path method_name, &block
|
32
|
+
test_relative_path method_name, &block
|
33
|
+
test_absolute_path method_name, &block
|
34
|
+
end
|
35
|
+
|
36
|
+
def base.test_absolute_path method_name, &block
|
37
|
+
define_method "#{method_name}_with_absolute_path" do
|
38
|
+
self.path = "#{File.expand_path PATH}/"
|
39
|
+
instance_eval(&block)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def base.test_relative_path method_name, &block
|
44
|
+
define_method method_name do
|
45
|
+
self.path = PATH
|
46
|
+
instance_eval(&block)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class TestDOMEntityReference < Nokogiri::TestCase
|
53
|
+
include Common
|
54
|
+
|
55
|
+
def setup
|
56
|
+
super
|
57
|
+
@parser = Nokogiri::XML::Document
|
58
|
+
end
|
59
|
+
|
60
|
+
test_relative_and_absolute_path :test_dom_entity_reference_with_dtdloda do
|
61
|
+
# Make sure that we can parse entity references and include them in the document
|
62
|
+
html = File.read xml_document
|
63
|
+
doc = @parser.parse html, path do |cfg|
|
64
|
+
cfg.default_xml
|
65
|
+
cfg.dtdload
|
66
|
+
cfg.noent
|
67
|
+
end
|
68
|
+
assert_equal [], doc.errors
|
69
|
+
assert_equal "foobar", doc.xpath('//blah').text
|
70
|
+
end
|
71
|
+
|
72
|
+
test_relative_and_absolute_path :test_dom_entity_reference_with_dtdvalid do
|
73
|
+
# Make sure that we can parse entity references and include them in the document
|
74
|
+
html = File.read xml_document
|
75
|
+
doc = @parser.parse html, path do |cfg|
|
76
|
+
cfg.default_xml
|
77
|
+
cfg.dtdvalid
|
78
|
+
cfg.noent
|
79
|
+
end
|
80
|
+
assert_equal [], doc.errors
|
81
|
+
assert_equal "foobar", doc.xpath('//blah').text
|
82
|
+
end
|
83
|
+
|
84
|
+
test_absolute_path :test_dom_dtd_loading_with_absolute_path do
|
85
|
+
# Make sure that we can parse entity references and include them in the document
|
86
|
+
html = %Q[<?xml version="1.0" encoding="UTF-8" ?>
|
87
|
+
<!DOCTYPE document SYSTEM "#{path}/document.dtd">
|
88
|
+
<document>
|
89
|
+
<body>&bar;</body>
|
90
|
+
</document>
|
91
|
+
]
|
92
|
+
doc = @parser.parse html, xml_document do |cfg|
|
93
|
+
cfg.default_xml
|
94
|
+
cfg.dtdvalid
|
95
|
+
cfg.noent
|
96
|
+
end
|
97
|
+
assert_equal [], doc.errors
|
98
|
+
assert_equal "foobar", doc.xpath('//blah').text
|
99
|
+
end
|
100
|
+
|
101
|
+
test_relative_and_absolute_path :test_dom_entity_reference_with_io do
|
102
|
+
# Make sure that we can parse entity references and include them in the document
|
103
|
+
html = File.open xml_document
|
104
|
+
doc = @parser.parse html, nil do |cfg|
|
105
|
+
cfg.default_xml
|
106
|
+
cfg.dtdload
|
107
|
+
cfg.noent
|
108
|
+
end
|
109
|
+
assert_equal [], doc.errors
|
110
|
+
assert_equal "foobar", doc.xpath('//blah').text
|
111
|
+
end
|
112
|
+
|
113
|
+
test_relative_and_absolute_path :test_dom_entity_reference_without_noent do
|
114
|
+
# Make sure that we don't include entity references unless NOENT is set to true
|
115
|
+
html = File.read xml_document
|
116
|
+
doc = @parser.parse html, path do |cfg|
|
117
|
+
cfg.default_xml
|
118
|
+
cfg.dtdload
|
119
|
+
end
|
120
|
+
assert_equal [], doc.errors
|
121
|
+
assert_kind_of Nokogiri::XML::EntityReference, doc.xpath('//body').first.children.first
|
122
|
+
end
|
123
|
+
|
124
|
+
test_relative_and_absolute_path :test_dom_entity_reference_without_dtdload do
|
125
|
+
# Make sure that we don't include entity references unless NOENT is set to true
|
126
|
+
html = File.read xml_document
|
127
|
+
doc = @parser.parse html, path do |cfg|
|
128
|
+
cfg.default_xml
|
129
|
+
end
|
130
|
+
assert_kind_of Nokogiri::XML::EntityReference, doc.xpath('//body').first.children.first
|
131
|
+
if Nokogiri.uses_libxml?
|
132
|
+
assert_equal ["Entity 'bar' not defined"], doc.errors.map(&:to_s)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
test_relative_and_absolute_path :test_document_dtd_loading_with_nonet do
|
137
|
+
# Make sure that we don't include remote entities unless NOENT is set to true
|
138
|
+
html = %Q[<?xml version="1.0" encoding="UTF-8" ?>
|
139
|
+
<!DOCTYPE document SYSTEM "http://foo.bar.com/">
|
140
|
+
<document>
|
141
|
+
<body>&bar;</body>
|
142
|
+
</document>
|
143
|
+
]
|
144
|
+
doc = @parser.parse html, path do |cfg|
|
145
|
+
cfg.default_xml
|
146
|
+
cfg.dtdload
|
147
|
+
end
|
148
|
+
assert_kind_of Nokogiri::XML::EntityReference, doc.xpath('//body').first.children.first
|
149
|
+
if Nokogiri.uses_libxml?
|
150
|
+
assert_equal ["Attempt to load network entity http://foo.bar.com/", "Entity 'bar' not defined"], doc.errors.map(&:to_s)
|
151
|
+
else
|
152
|
+
assert_equal ["Attempt to load network entity http://foo.bar.com/"], doc.errors.map(&:to_s)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
# TODO: can we retreive a resource pointing to localhost when NONET is set to true ?
|
156
|
+
end
|
157
|
+
|
158
|
+
class TestSaxEntityReference < Nokogiri::SAX::TestCase
|
159
|
+
include Common
|
160
|
+
|
161
|
+
def setup
|
162
|
+
super
|
163
|
+
@parser = XML::SAX::Parser.new(Doc.new) do |ctx|
|
164
|
+
ctx.replace_entities = true
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
test_relative_and_absolute_path :test_sax_entity_reference do
|
169
|
+
# Make sure that we can parse entity references and include them in the document
|
170
|
+
html = File.read xml_document
|
171
|
+
@parser.parse html
|
172
|
+
refute_nil @parser.document.errors
|
173
|
+
assert_equal ["Entity 'bar' not defined"], @parser.document.errors.map(&:to_s).map(&:strip)
|
174
|
+
end
|
175
|
+
|
176
|
+
test_relative_and_absolute_path :test_more_sax_entity_reference do
|
177
|
+
# Make sure that we don't include entity references unless NOENT is set to true
|
178
|
+
html = %Q[<?xml version="1.0" encoding="UTF-8" ?>
|
179
|
+
<!DOCTYPE document SYSTEM "http://foo.bar.com/">
|
180
|
+
<document>
|
181
|
+
<body>&bar;</body>
|
182
|
+
</document>
|
183
|
+
]
|
184
|
+
@parser.parse html
|
185
|
+
refute_nil @parser.document.errors
|
186
|
+
assert_equal ["Entity 'bar' not defined"], @parser.document.errors.map(&:to_s).map(&:strip)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
class TestReaderEntityReference < Nokogiri::TestCase
|
191
|
+
include Common
|
192
|
+
|
193
|
+
def setup
|
194
|
+
super
|
195
|
+
end
|
196
|
+
|
197
|
+
test_relative_and_absolute_path :test_reader_entity_reference do
|
198
|
+
# Make sure that we can parse entity references and include them in the document
|
199
|
+
html = File.read xml_document
|
200
|
+
reader = Nokogiri::XML::Reader html, path do |cfg|
|
201
|
+
cfg.default_xml
|
202
|
+
cfg.dtdload
|
203
|
+
cfg.noent
|
204
|
+
end
|
205
|
+
nodes = []
|
206
|
+
reader.each { |n| nodes << n.value }
|
207
|
+
assert_equal ['foobar'], nodes.compact.map(&:strip).reject(&:empty?)
|
208
|
+
end
|
209
|
+
|
210
|
+
test_relative_and_absolute_path :test_reader_entity_reference_without_noent do
|
211
|
+
# Make sure that we can parse entity references and include them in the document
|
212
|
+
html = File.read xml_document
|
213
|
+
reader = Nokogiri::XML::Reader html, path do |cfg|
|
214
|
+
cfg.default_xml
|
215
|
+
cfg.dtdload
|
216
|
+
end
|
217
|
+
nodes = []
|
218
|
+
reader.each { |n| nodes << n.value }
|
219
|
+
assert_equal [], nodes.compact.map(&:strip).reject(&:empty?)
|
220
|
+
end
|
221
|
+
|
222
|
+
test_relative_and_absolute_path :test_reader_entity_reference_without_dtdload do
|
223
|
+
# Make sure that we can parse entity references and include them in the document
|
224
|
+
html = File.read xml_document
|
225
|
+
assert_raises(Nokogiri::XML::SyntaxError) do
|
226
|
+
reader = Nokogiri::XML::Reader html, path do |cfg|
|
227
|
+
cfg.default_xml
|
228
|
+
end
|
229
|
+
nodes = []
|
230
|
+
reader.each { |n| nodes << n.value }
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
20
234
|
end
|
21
235
|
end
|
@@ -329,7 +329,7 @@ module Nokogiri
|
|
329
329
|
|
330
330
|
describe "unlinking a node and then reparenting it" do
|
331
331
|
it "not blow up" do
|
332
|
-
# see http://github.com/
|
332
|
+
# see http://github.com/sparklemotion/nokogiri/issues#issue/22
|
333
333
|
10.times do
|
334
334
|
begin
|
335
335
|
doc = Nokogiri::XML <<-EOHTML
|
data/test/xml/test_xpath.rb
CHANGED
@@ -217,7 +217,7 @@ module Nokogiri
|
|
217
217
|
end
|
218
218
|
|
219
219
|
def test_custom_xpath_handler_with_args_under_gc_pressure
|
220
|
-
# see http://github.com/
|
220
|
+
# see http://github.com/sparklemotion/nokogiri/issues/#issue/345
|
221
221
|
tool_inspector = Class.new do
|
222
222
|
def name_equals(nodeset, name, *args)
|
223
223
|
nodeset.all? do |node|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -3529927108
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
9
|
- 5
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 1.5.5.
|
11
|
+
- 3
|
12
|
+
version: 1.5.5.rc3
|
13
13
|
platform: x86-mswin32-60
|
14
14
|
authors:
|
15
15
|
- Aaron Patterson
|
@@ -20,7 +20,7 @@ autorequire:
|
|
20
20
|
bindir: bin
|
21
21
|
cert_chain: []
|
22
22
|
|
23
|
-
date: 2012-06-
|
23
|
+
date: 2012-06-22 00:00:00 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hoe-bundler
|