nokogiri 1.0.6-x86-mswin32-60 → 1.0.7-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/History.ja.txt +11 -0
- data/History.txt +11 -0
- data/Manifest.txt +7 -0
- data/README.txt +7 -0
- data/Rakefile +43 -2
- data/ext/nokogiri/native.c +1 -0
- data/ext/nokogiri/native.h +1 -2
- data/ext/nokogiri/native.so +0 -0
- data/ext/nokogiri/xml_cdata.c +3 -1
- data/ext/nokogiri/xml_comment.c +42 -0
- data/ext/nokogiri/xml_comment.h +9 -0
- data/ext/nokogiri/xml_document.c +1 -0
- data/ext/nokogiri/xml_node.c +21 -7
- data/ext/nokogiri/xml_sax_parser.c +26 -0
- data/ext/nokogiri/xml_syntax_error.c +4 -0
- data/ext/nokogiri/xml_text.c +16 -1
- data/ext/nokogiri/xml_xpath_context.c +4 -0
- data/ext/nokogiri/xslt_stylesheet.c +1 -1
- data/lib/action-nokogiri.rb +30 -0
- data/lib/nokogiri.rb +25 -4
- data/lib/nokogiri/css.rb +9 -4
- data/lib/nokogiri/css/generated_parser.rb +199 -171
- data/lib/nokogiri/css/parser.rb +11 -0
- data/lib/nokogiri/css/parser.y +16 -0
- data/lib/nokogiri/decorators.rb +1 -0
- data/lib/nokogiri/decorators/slop.rb +31 -0
- data/lib/nokogiri/hpricot.rb +2 -4
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml.rb +15 -0
- data/lib/nokogiri/xml/builder.rb +1 -1
- data/lib/nokogiri/xml/comment.rb +6 -0
- data/lib/nokogiri/xml/document.rb +22 -8
- data/lib/nokogiri/xml/sax/parser.rb +7 -3
- data/test/css/test_parser.rb +9 -0
- data/test/helper.rb +4 -1
- data/test/hpricot/load_files.rb +8 -4
- data/test/test_css_cache.rb +17 -10
- data/test/test_memory_leak.rb +38 -0
- data/test/test_nokogiri.rb +61 -0
- data/test/xml/sax/test_parser.rb +2 -0
- data/test/xml/test_comment.rb +16 -0
- data/test/xml/test_document.rb +2 -4
- data/test/xml/test_node.rb +13 -0
- data/vendor/hoe.rb +8 -22
- metadata +11 -2
data/History.ja.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 1.0.7
|
2
|
+
|
3
|
+
* バグの修正
|
4
|
+
|
5
|
+
* Dike 使用時中のメモリーリークの修正
|
6
|
+
* SAX パーサーが現在 IO Stream 同時解析
|
7
|
+
* コメント nodes が独自のクラスを継承する
|
8
|
+
* Nokogiri() は Nokogiri.parse() へデリゲートする
|
9
|
+
* ENV['PATH'] に付加せれる代わりに先頭へデータ挿入される
|
10
|
+
* 複雑な CSS 内のバグを修正完了 :not selector ではありません
|
11
|
+
|
1
12
|
=== 1.0.6
|
2
13
|
|
3
14
|
* 5つの修正
|
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 1.0.7
|
2
|
+
|
3
|
+
* Bugfixes
|
4
|
+
|
5
|
+
* Fixed memory leak when using Dike
|
6
|
+
* SAX parser now parses IO streams
|
7
|
+
* Comment nodes have their own class
|
8
|
+
* Nokogiri() should delegate to Nokogiri.parse()
|
9
|
+
* Prepending rather than appending to ENV['PATH'] on windows
|
10
|
+
* Fixed a bug in complex CSS negation selectors
|
11
|
+
|
1
12
|
=== 1.0.6
|
2
13
|
|
3
14
|
* 5 Bugfixes
|
data/Manifest.txt
CHANGED
@@ -13,6 +13,8 @@ ext/nokogiri/native.c
|
|
13
13
|
ext/nokogiri/native.h
|
14
14
|
ext/nokogiri/xml_cdata.c
|
15
15
|
ext/nokogiri/xml_cdata.h
|
16
|
+
ext/nokogiri/xml_comment.c
|
17
|
+
ext/nokogiri/xml_comment.h
|
16
18
|
ext/nokogiri/xml_document.c
|
17
19
|
ext/nokogiri/xml_document.h
|
18
20
|
ext/nokogiri/xml_dtd.c
|
@@ -37,6 +39,7 @@ ext/nokogiri/xml_xpath_context.c
|
|
37
39
|
ext/nokogiri/xml_xpath_context.h
|
38
40
|
ext/nokogiri/xslt_stylesheet.c
|
39
41
|
ext/nokogiri/xslt_stylesheet.h
|
42
|
+
lib/action-nokogiri.rb
|
40
43
|
lib/nokogiri.rb
|
41
44
|
lib/nokogiri/css.rb
|
42
45
|
lib/nokogiri/css/generated_parser.rb
|
@@ -53,6 +56,7 @@ lib/nokogiri/decorators/hpricot.rb
|
|
53
56
|
lib/nokogiri/decorators/hpricot/node.rb
|
54
57
|
lib/nokogiri/decorators/hpricot/node_set.rb
|
55
58
|
lib/nokogiri/decorators/hpricot/xpath_visitor.rb
|
59
|
+
lib/nokogiri/decorators/slop.rb
|
56
60
|
lib/nokogiri/hpricot.rb
|
57
61
|
lib/nokogiri/html.rb
|
58
62
|
lib/nokogiri/html/builder.rb
|
@@ -64,6 +68,7 @@ lib/nokogiri/xml/after_handler.rb
|
|
64
68
|
lib/nokogiri/xml/before_handler.rb
|
65
69
|
lib/nokogiri/xml/builder.rb
|
66
70
|
lib/nokogiri/xml/cdata.rb
|
71
|
+
lib/nokogiri/xml/comment.rb
|
67
72
|
lib/nokogiri/xml/document.rb
|
68
73
|
lib/nokogiri/xml/dtd.rb
|
69
74
|
lib/nokogiri/xml/element.rb
|
@@ -114,12 +119,14 @@ test/html/test_document.rb
|
|
114
119
|
test/test_convert_xpath.rb
|
115
120
|
test/test_css_cache.rb
|
116
121
|
test/test_gc.rb
|
122
|
+
test/test_memory_leak.rb
|
117
123
|
test/test_nokogiri.rb
|
118
124
|
test/test_reader.rb
|
119
125
|
test/test_xslt_transforms.rb
|
120
126
|
test/xml/sax/test_parser.rb
|
121
127
|
test/xml/test_builder.rb
|
122
128
|
test/xml/test_cdata.rb
|
129
|
+
test/xml/test_comment.rb
|
123
130
|
test/xml/test_document.rb
|
124
131
|
test/xml/test_dtd.rb
|
125
132
|
test/xml/test_node.rb
|
data/README.txt
CHANGED
data/Rakefile
CHANGED
@@ -30,7 +30,7 @@ HOE = Hoe.new('nokogiri', Nokogiri::VERSION) do |p|
|
|
30
30
|
GENERATED_TOKENIZER,
|
31
31
|
'cross',
|
32
32
|
]
|
33
|
-
p.spec_extras = { :extensions => ["
|
33
|
+
p.spec_extras = { :extensions => ["ext/nokogiri/extconf.rb"] }
|
34
34
|
end
|
35
35
|
|
36
36
|
namespace :gem do
|
@@ -87,7 +87,9 @@ end
|
|
87
87
|
|
88
88
|
file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
|
89
89
|
begin
|
90
|
-
|
90
|
+
racc = `which racc`.strip
|
91
|
+
racc = "#{::Config::CONFIG['bindir']}/racc" if racc.empty?
|
92
|
+
sh "#{racc} -o #{t.name} #{t.prerequisites.first}"
|
91
93
|
rescue
|
92
94
|
abort "need racc, get the tarball from http://i.loveruby.net/archive/racc/racc-1.4.5-all.tar.gz"
|
93
95
|
end
|
@@ -277,8 +279,47 @@ namespace :test do
|
|
277
279
|
ENV['NOKOGIRI_GC'] = "true"
|
278
280
|
Rake::Task["test"].invoke
|
279
281
|
end
|
282
|
+
|
283
|
+
desc "find call-seq in the rdoc"
|
284
|
+
task :rdoc => 'docs' do
|
285
|
+
Dir['doc/**/*.html'].each { |docfile|
|
286
|
+
next if docfile =~ /\.src/
|
287
|
+
puts "FAIL: #{docfile}" if File.read(docfile) =~ /call-seq/
|
288
|
+
}
|
289
|
+
end
|
280
290
|
end
|
281
291
|
|
292
|
+
namespace :install do
|
293
|
+
desc "Install frex and racc for development"
|
294
|
+
task :deps => %w(frex racc)
|
295
|
+
|
296
|
+
directory "stash"
|
297
|
+
|
298
|
+
file "stash/racc-1.4.5-all.tar.gz" => "stash" do |t|
|
299
|
+
puts "Downloading racc to #{t.name}..."
|
300
|
+
|
301
|
+
Dir.chdir File.dirname(t.name) do
|
302
|
+
url = "http://i.loveruby.net/archive/racc/racc-1.4.5-all.tar.gz"
|
303
|
+
system "wget #{url} || curl -O #{url}"
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
task :racc => "stash/racc-1.4.5-all.tar.gz" do |t|
|
308
|
+
sh "tar xvf #{t.prerequisites.first} -C stash"
|
309
|
+
|
310
|
+
Dir.chdir "stash/#{File.basename(t.prerequisites.first, ".tar.gz")}" do
|
311
|
+
sh "ruby setup.rb config"
|
312
|
+
sh "ruby setup.rb setup"
|
313
|
+
sh "sudo ruby setup.rb install"
|
314
|
+
end
|
315
|
+
|
316
|
+
puts "The racc binary is likely in #{::Config::CONFIG["bindir"]}."
|
317
|
+
end
|
318
|
+
|
319
|
+
task :frex do
|
320
|
+
sh "sudo gem install aaronp-frex -s http://gems.github.com"
|
321
|
+
end
|
322
|
+
end
|
282
323
|
|
283
324
|
# Only do this on unix, since we can't build on windows
|
284
325
|
unless windows
|
data/ext/nokogiri/native.c
CHANGED
data/ext/nokogiri/native.h
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
#include <xml_node.h>
|
18
18
|
#include <xml_text.h>
|
19
19
|
#include <xml_cdata.h>
|
20
|
+
#include <xml_comment.h>
|
20
21
|
#include <xml_node_set.h>
|
21
22
|
#include <xml_xpath.h>
|
22
23
|
#include <xml_dtd.h>
|
@@ -36,13 +37,11 @@ extern VALUE mNokogiriXslt ;
|
|
36
37
|
|
37
38
|
#ifdef DEBUG
|
38
39
|
|
39
|
-
#define NOKOGIRI_DEBUG_START_NODE(p) if (getenv("NOKOGIRI_NO_FREE")) return ; if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p start node (%p %x %p/%s)\n", __FILE__, __LINE__, p, p->_private, p->type, p->name, p->name);
|
40
40
|
#define NOKOGIRI_DEBUG_START(p) if (getenv("NOKOGIRI_NO_FREE")) return ; if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p start\n", __FILE__, __LINE__, p);
|
41
41
|
#define NOKOGIRI_DEBUG_END(p) if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p end\n", __FILE__, __LINE__, p);
|
42
42
|
|
43
43
|
#else
|
44
44
|
|
45
|
-
#define NOKOGIRI_DEBUG_START_NODE(p)
|
46
45
|
#define NOKOGIRI_DEBUG_START(p)
|
47
46
|
#define NOKOGIRI_DEBUG_END(p)
|
48
47
|
|
data/ext/nokogiri/native.so
CHANGED
Binary file
|
data/ext/nokogiri/xml_cdata.c
CHANGED
@@ -29,11 +29,13 @@ void init_xml_cdata()
|
|
29
29
|
{
|
30
30
|
VALUE nokogiri = rb_define_module("Nokogiri");
|
31
31
|
VALUE xml = rb_define_module_under(nokogiri, "XML");
|
32
|
+
VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
|
33
|
+
VALUE text = rb_define_class_under(xml, "Text", node);
|
32
34
|
|
33
35
|
/*
|
34
36
|
* CData represents a CData node in an xml document.
|
35
37
|
*/
|
36
|
-
VALUE klass = rb_define_class_under(xml, "
|
38
|
+
VALUE klass = rb_define_class_under(xml, "CDATA", text);
|
37
39
|
|
38
40
|
|
39
41
|
cNokogiriXmlCData = klass;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#include <xml_comment.h>
|
2
|
+
|
3
|
+
/*
|
4
|
+
* call-seq:
|
5
|
+
* new(document, content)
|
6
|
+
*
|
7
|
+
* Create a new Comment element on the +document+ with +content+
|
8
|
+
*/
|
9
|
+
static VALUE new(VALUE klass, VALUE doc, VALUE content)
|
10
|
+
{
|
11
|
+
xmlDocPtr xml_doc;
|
12
|
+
Data_Get_Struct(doc, xmlDoc, xml_doc);
|
13
|
+
|
14
|
+
xmlNodePtr node = xmlNewDocComment(
|
15
|
+
xml_doc,
|
16
|
+
(const xmlChar *)StringValuePtr(content)
|
17
|
+
);
|
18
|
+
|
19
|
+
VALUE rb_node = Nokogiri_wrap_xml_node(node);
|
20
|
+
|
21
|
+
if(rb_block_given_p()) rb_yield(rb_node);
|
22
|
+
|
23
|
+
return rb_node;
|
24
|
+
}
|
25
|
+
|
26
|
+
VALUE cNokogiriXmlComment;
|
27
|
+
void init_xml_comment()
|
28
|
+
{
|
29
|
+
VALUE nokogiri = rb_define_module("Nokogiri");
|
30
|
+
VALUE xml = rb_define_module_under(nokogiri, "XML");
|
31
|
+
VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
|
32
|
+
|
33
|
+
/*
|
34
|
+
* Comment represents a comment node in an xml document.
|
35
|
+
*/
|
36
|
+
VALUE klass = rb_define_class_under(xml, "Comment", node);
|
37
|
+
|
38
|
+
|
39
|
+
cNokogiriXmlComment = klass;
|
40
|
+
|
41
|
+
rb_define_singleton_method(klass, "new", new, 2);
|
42
|
+
}
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -199,6 +199,7 @@ VALUE Nokogiri_wrap_xml_document(VALUE klass, xmlDocPtr doc)
|
|
199
199
|
VALUE rb_doc = Qnil;
|
200
200
|
|
201
201
|
rb_doc = Data_Wrap_Struct(klass ? klass : cNokogiriXmlDocument, 0, dealloc, doc) ;
|
202
|
+
rb_iv_set(rb_doc, "@decorators", Qnil);
|
202
203
|
doc->_private = (void *)rb_doc;
|
203
204
|
|
204
205
|
return rb_doc ;
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
#include <xml_node.h>
|
2
2
|
|
3
|
+
#ifdef DEBUG
|
4
|
+
static void debug_node_dealloc(xmlNodePtr x)
|
5
|
+
{
|
6
|
+
NOKOGIRI_DEBUG_START(x)
|
7
|
+
NOKOGIRI_DEBUG_END(x)
|
8
|
+
}
|
9
|
+
#else
|
10
|
+
# define debug_node_dealloc 0
|
11
|
+
#endif
|
12
|
+
|
3
13
|
/*
|
4
14
|
* call-seq:
|
5
15
|
* pointer_id
|
@@ -532,26 +542,30 @@ VALUE Nokogiri_wrap_xml_node(xmlNodePtr node)
|
|
532
542
|
|
533
543
|
case XML_TEXT_NODE:
|
534
544
|
klass = rb_const_get(mNokogiriXml, rb_intern("Text"));
|
535
|
-
rb_node = Data_Wrap_Struct(klass, 0,
|
545
|
+
rb_node = Data_Wrap_Struct(klass, 0, debug_node_dealloc, node) ;
|
546
|
+
break;
|
547
|
+
case XML_COMMENT_NODE:
|
548
|
+
klass = cNokogiriXmlComment;
|
549
|
+
rb_node = Data_Wrap_Struct(klass, 0, debug_node_dealloc, node) ;
|
536
550
|
break;
|
537
551
|
case XML_ELEMENT_NODE:
|
538
552
|
klass = rb_const_get(mNokogiriXml, rb_intern("Element"));
|
539
|
-
rb_node = Data_Wrap_Struct(klass, 0,
|
553
|
+
rb_node = Data_Wrap_Struct(klass, 0, debug_node_dealloc, node) ;
|
540
554
|
break;
|
541
555
|
case XML_ENTITY_DECL:
|
542
556
|
klass = rb_const_get(mNokogiriXml, rb_intern("EntityDeclaration"));
|
543
|
-
rb_node = Data_Wrap_Struct(klass, 0,
|
557
|
+
rb_node = Data_Wrap_Struct(klass, 0, debug_node_dealloc, node) ;
|
544
558
|
break;
|
545
559
|
case XML_CDATA_SECTION_NODE:
|
546
|
-
klass =
|
547
|
-
rb_node = Data_Wrap_Struct(klass, 0,
|
560
|
+
klass = cNokogiriXmlCData;
|
561
|
+
rb_node = Data_Wrap_Struct(klass, 0, debug_node_dealloc, node) ;
|
548
562
|
break;
|
549
563
|
case XML_DTD_NODE:
|
550
564
|
klass = rb_const_get(mNokogiriXml, rb_intern("DTD"));
|
551
|
-
rb_node = Data_Wrap_Struct(klass, 0,
|
565
|
+
rb_node = Data_Wrap_Struct(klass, 0, debug_node_dealloc, node) ;
|
552
566
|
break;
|
553
567
|
default:
|
554
|
-
rb_node = Data_Wrap_Struct(cNokogiriXmlNode, 0,
|
568
|
+
rb_node = Data_Wrap_Struct(cNokogiriXmlNode, 0, debug_node_dealloc, node) ;
|
555
569
|
}
|
556
570
|
|
557
571
|
rb_hash_aset(node_cache, index, rb_node);
|
@@ -20,6 +20,31 @@ static VALUE parse_memory(VALUE self, VALUE data)
|
|
20
20
|
return data;
|
21
21
|
}
|
22
22
|
|
23
|
+
/*
|
24
|
+
* call-seq:
|
25
|
+
* native_parse_io(data, encoding)
|
26
|
+
*
|
27
|
+
* Parse the document accessable via +io+
|
28
|
+
*/
|
29
|
+
static VALUE native_parse_io(VALUE self, VALUE io, VALUE encoding)
|
30
|
+
{
|
31
|
+
xmlSAXHandlerPtr handler;
|
32
|
+
Data_Get_Struct(self, xmlSAXHandler, handler);
|
33
|
+
|
34
|
+
xmlCharEncoding enc = (xmlCharEncoding)NUM2INT(encoding);
|
35
|
+
|
36
|
+
xmlParserCtxtPtr sax_ctx = xmlCreateIOParserCtxt(
|
37
|
+
handler,
|
38
|
+
(void *)self,
|
39
|
+
(xmlInputReadCallback)io_read_callback,
|
40
|
+
(xmlInputCloseCallback)io_close_callback,
|
41
|
+
(void *)io,
|
42
|
+
enc
|
43
|
+
);
|
44
|
+
xmlParseDocument(sax_ctx);
|
45
|
+
return io;
|
46
|
+
}
|
47
|
+
|
23
48
|
static VALUE native_parse_file(VALUE self, VALUE data)
|
24
49
|
{
|
25
50
|
xmlSAXHandlerPtr handler;
|
@@ -171,4 +196,5 @@ void init_xml_sax_parser()
|
|
171
196
|
rb_define_alloc_func(klass, allocate);
|
172
197
|
rb_define_method(klass, "parse_memory", parse_memory, 1);
|
173
198
|
rb_define_private_method(klass, "native_parse_file", native_parse_file, 1);
|
199
|
+
rb_define_private_method(klass, "native_parse_io", native_parse_io, 2);
|
174
200
|
}
|
@@ -178,6 +178,10 @@ void init_xml_syntax_error()
|
|
178
178
|
{
|
179
179
|
VALUE nokogiri = rb_define_module("Nokogiri");
|
180
180
|
VALUE xml = rb_define_module_under(nokogiri, "XML");
|
181
|
+
|
182
|
+
/*
|
183
|
+
* The XML::SyntaxError is raised on parse errors
|
184
|
+
*/
|
181
185
|
VALUE klass = rb_define_class_under(xml, "SyntaxError", rb_eSyntaxError);
|
182
186
|
cNokogiriXmlSyntaxError = klass;
|
183
187
|
|
data/ext/nokogiri/xml_text.c
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
#include <xml_text.h>
|
2
2
|
|
3
|
+
/*
|
4
|
+
* call-seq:
|
5
|
+
* new(content, document)
|
6
|
+
*
|
7
|
+
* Create a new Text element on the +document+ with +content+
|
8
|
+
*/
|
3
9
|
static VALUE new(VALUE klass, VALUE string, VALUE document)
|
4
10
|
{
|
5
11
|
xmlDocPtr doc;
|
@@ -18,7 +24,16 @@ static VALUE new(VALUE klass, VALUE string, VALUE document)
|
|
18
24
|
VALUE cNokogiriXmlText ;
|
19
25
|
void init_xml_text()
|
20
26
|
{
|
21
|
-
VALUE
|
27
|
+
VALUE nokogiri = rb_define_module("Nokogiri");
|
28
|
+
VALUE xml = rb_define_module_under(nokogiri, "XML");
|
29
|
+
VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
|
30
|
+
|
31
|
+
/*
|
32
|
+
* Wraps Text nodes.
|
33
|
+
*/
|
34
|
+
VALUE klass = rb_define_class_under(xml, "Text", node);
|
35
|
+
|
36
|
+
cNokogiriXmlText = klass;
|
22
37
|
|
23
38
|
rb_define_singleton_method(klass, "new", new, 2);
|
24
39
|
}
|
@@ -73,7 +73,7 @@ static VALUE apply_to(int argc, VALUE* argv, VALUE self)
|
|
73
73
|
Data_Get_Struct(xmldoc, xmlDoc, xml);
|
74
74
|
Data_Get_Struct(self, xsltStylesheet, ss);
|
75
75
|
|
76
|
-
param_len =
|
76
|
+
param_len = NUM2INT(rb_funcall(paramobj, rb_intern("length"), 0));
|
77
77
|
params = calloc((size_t)param_len+1, sizeof(char*));
|
78
78
|
for (j = 0 ; j < param_len ; j++) {
|
79
79
|
VALUE entry = rb_ary_entry(paramobj, j);
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
#
|
4
|
+
# to use this in your Rails view or controller tests, simply:
|
5
|
+
#
|
6
|
+
# require 'action-nokogiri'
|
7
|
+
#
|
8
|
+
# class KittehControllerTest < ActionController::TestCase
|
9
|
+
# def test_i_can_does_test_with_nokogiri
|
10
|
+
# get(:index, {:wants => "cheezburgers"})
|
11
|
+
# assert @response.html.at("h2.lolcats")
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
module ActionController
|
15
|
+
module TestResponseBehavior
|
16
|
+
|
17
|
+
def html(flavor=nil)
|
18
|
+
if flavor == :hpricot
|
19
|
+
@_nokogiri_html_hpricot ||= Nokogiri::Hpricot(body)
|
20
|
+
else
|
21
|
+
@_nokogiri_html_vanilla ||= Nokogiri::HTML(body)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def xml
|
26
|
+
@_nokogiri_xml ||= Nokogiri::XML(body)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|