nokogiri 1.10.8-x86-mingw32 → 1.11.0.rc3-x86-mingw32
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.
- checksums.yaml +4 -4
- data/README.md +24 -22
- data/ext/nokogiri/extconf.rb +50 -37
- data/ext/nokogiri/nokogiri.c +12 -6
- data/ext/nokogiri/nokogiri.h +13 -0
- data/ext/nokogiri/xml_document.c +16 -2
- data/ext/nokogiri/xml_io.c +8 -6
- data/ext/nokogiri/xml_node.c +20 -0
- data/ext/nokogiri/xml_reader.c +6 -17
- data/ext/nokogiri/xml_schema.c +29 -0
- data/ext/nokogiri/xslt_stylesheet.c +0 -4
- data/lib/nokogiri.rb +3 -20
- data/lib/nokogiri/2.4/nokogiri.so +0 -0
- data/lib/nokogiri/2.5/nokogiri.so +0 -0
- data/lib/nokogiri/2.6/nokogiri.so +0 -0
- data/lib/nokogiri/{2.3 → 2.7}/nokogiri.so +0 -0
- data/lib/nokogiri/css.rb +1 -0
- data/lib/nokogiri/css/node.rb +1 -0
- data/lib/nokogiri/css/parser.rb +61 -60
- data/lib/nokogiri/css/parser_extras.rb +39 -36
- data/lib/nokogiri/css/syntax_error.rb +1 -0
- data/lib/nokogiri/css/tokenizer.rb +1 -0
- data/lib/nokogiri/css/xpath_visitor.rb +3 -1
- data/lib/nokogiri/decorators/slop.rb +1 -0
- data/lib/nokogiri/html.rb +1 -0
- data/lib/nokogiri/html/builder.rb +1 -0
- data/lib/nokogiri/html/document.rb +1 -0
- data/lib/nokogiri/html/document_fragment.rb +1 -0
- data/lib/nokogiri/html/element_description.rb +1 -0
- data/lib/nokogiri/html/element_description_defaults.rb +1 -0
- data/lib/nokogiri/html/entity_lookup.rb +1 -0
- data/lib/nokogiri/html/sax/parser.rb +1 -0
- data/lib/nokogiri/html/sax/parser_context.rb +1 -0
- data/lib/nokogiri/html/sax/push_parser.rb +1 -0
- data/lib/nokogiri/jruby/dependencies.rb +20 -0
- data/lib/nokogiri/syntax_error.rb +1 -0
- data/lib/nokogiri/version.rb +86 -45
- data/lib/nokogiri/xml.rb +1 -0
- data/lib/nokogiri/xml/attr.rb +1 -0
- data/lib/nokogiri/xml/attribute_decl.rb +1 -0
- data/lib/nokogiri/xml/builder.rb +3 -2
- data/lib/nokogiri/xml/cdata.rb +1 -0
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +3 -8
- data/lib/nokogiri/xml/document_fragment.rb +1 -0
- data/lib/nokogiri/xml/dtd.rb +1 -0
- data/lib/nokogiri/xml/element_content.rb +1 -0
- data/lib/nokogiri/xml/element_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_reference.rb +1 -0
- data/lib/nokogiri/xml/namespace.rb +1 -0
- data/lib/nokogiri/xml/node.rb +539 -224
- data/lib/nokogiri/xml/node/save_options.rb +1 -0
- data/lib/nokogiri/xml/node_set.rb +1 -0
- data/lib/nokogiri/xml/notation.rb +1 -0
- data/lib/nokogiri/xml/parse_options.rb +4 -3
- data/lib/nokogiri/xml/pp.rb +1 -0
- data/lib/nokogiri/xml/pp/character_data.rb +1 -0
- data/lib/nokogiri/xml/pp/node.rb +1 -0
- data/lib/nokogiri/xml/processing_instruction.rb +1 -0
- data/lib/nokogiri/xml/reader.rb +7 -3
- data/lib/nokogiri/xml/relax_ng.rb +1 -0
- data/lib/nokogiri/xml/sax.rb +1 -0
- data/lib/nokogiri/xml/sax/document.rb +1 -0
- data/lib/nokogiri/xml/sax/parser.rb +1 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +1 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +1 -0
- data/lib/nokogiri/xml/schema.rb +1 -0
- data/lib/nokogiri/xml/searchable.rb +22 -15
- data/lib/nokogiri/xml/syntax_error.rb +1 -0
- data/lib/nokogiri/xml/text.rb +1 -0
- data/lib/nokogiri/xml/xpath.rb +1 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +1 -0
- data/lib/nokogiri/xml/xpath_context.rb +1 -0
- data/lib/nokogiri/xslt.rb +1 -0
- data/lib/nokogiri/xslt/stylesheet.rb +1 -0
- data/lib/xsd/xmlparser/nokogiri.rb +1 -0
- metadata +46 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73055ead317fd398bc0395d57479e5f2ea592e41163244213d765aab7047ba15
|
4
|
+
data.tar.gz: e8ca02fef8812ad4db1e0429b3b5a38199948b848893de01cda747823c67191d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f85f4b8158adf638e9988cfd621e1145b972cc2e3db89d738505f5aec3e87f281b806361db2eb0383c256c93a34ae05cd4deaf3ff2188ada9ad94955b561333
|
7
|
+
data.tar.gz: a1d1749ac88793440c1be4164d260cf16d0e926719c45ea97b18a9955f6a66f87a423fc2d112a9895915246b5aa37c70779535830115d59eeb03d1591195837a
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ or CSS3 selectors.
|
|
11
11
|
|
12
12
|
* https://nokogiri.org
|
13
13
|
* [Installation Help](https://nokogiri.org/tutorials/installing_nokogiri.html)
|
14
|
-
* [Tutorials](https://nokogiri.org)
|
14
|
+
* [Tutorials](https://nokogiri.org/tutorials/toc.html)
|
15
15
|
* [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet)
|
16
16
|
* [GitHub](https://github.com/sparklemotion/nokogiri)
|
17
17
|
* [Mailing List](https://groups.google.com/group/nokogiri-talk)
|
@@ -20,14 +20,14 @@ or CSS3 selectors.
|
|
20
20
|
|
21
21
|
## Status
|
22
22
|
|
23
|
-
[![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/nokogiri/jobs/
|
23
|
+
[![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/nokogiri/jobs/cruby-2.7/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/nokogiri)
|
24
24
|
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/xj2pqwvlxwuwgr06/branch/master?svg=true)](https://ci.appveyor.com/project/flavorjones/nokogiri/branch/master)
|
25
25
|
[![Code Climate](https://codeclimate.com/github/sparklemotion/nokogiri.svg)](https://codeclimate.com/github/sparklemotion/nokogiri)
|
26
26
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/59c67b0e8976027a45ad/test_coverage)](https://codeclimate.com/github/sparklemotion/nokogiri/test_coverage)
|
27
27
|
|
28
28
|
[![Gem Version](https://badge.fury.io/rb/nokogiri.svg)](https://rubygems.org/gems/nokogiri)
|
29
|
-
[![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score
|
30
|
-
[![Tidelift dependencies](https://tidelift.com/badges/
|
29
|
+
[![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score/?dependency-name=nokogiri&package-manager=bundler)
|
30
|
+
[![Tidelift dependencies](https://tidelift.com/badges/package/rubygems/nokogiri)](https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme)
|
31
31
|
|
32
32
|
|
33
33
|
## Features
|
@@ -71,7 +71,7 @@ help you directly and improve the documentation.
|
|
71
71
|
Binary packages are available for some distributions.
|
72
72
|
|
73
73
|
* Debian: https://packages.debian.org/sid/ruby-nokogiri
|
74
|
-
*
|
74
|
+
* openSUSE/SLE: https://download.opensuse.org/repositories/devel:/languages:/ruby:/extensions/
|
75
75
|
* Fedora: http://s390.koji.fedoraproject.org/koji/packageinfo?packageID=6756
|
76
76
|
|
77
77
|
|
@@ -108,7 +108,7 @@ require 'nokogiri'
|
|
108
108
|
require 'open-uri'
|
109
109
|
|
110
110
|
# Fetch and parse HTML document
|
111
|
-
doc = Nokogiri::HTML(open('https://nokogiri.org/tutorials/installing_nokogiri.html'))
|
111
|
+
doc = Nokogiri::HTML(URI.open('https://nokogiri.org/tutorials/installing_nokogiri.html'))
|
112
112
|
|
113
113
|
puts "### Search for nodes by css"
|
114
114
|
doc.css('nav ul.menu li a', 'article h2').each do |link|
|
@@ -129,27 +129,23 @@ end
|
|
129
129
|
|
130
130
|
## Requirements
|
131
131
|
|
132
|
-
|
133
|
-
to compile native extensions.
|
132
|
+
Ruby 2.4.0 or higher, including any development packages necessary to compile native extensions.
|
134
133
|
|
135
|
-
|
136
|
-
gem, but if you want to use the system versions:
|
134
|
+
In Nokogiri 1.6.0 and later libxml2 and libxslt are bundled with the gem, but if you want to use the system versions:
|
137
135
|
|
138
|
-
|
139
|
-
|
140
|
-
|
136
|
+
* First, check out [the long list](http://www.xmlsoft.org/news.html)
|
137
|
+
of fixes and changes between releases before deciding to use any
|
138
|
+
version older than is bundled with Nokogiri.
|
141
139
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
140
|
+
* At install time, set the environment variable
|
141
|
+
`NOKOGIRI_USE_SYSTEM_LIBRARIES` or else use the
|
142
|
+
`--use-system-libraries` argument. (See
|
143
|
+
https://nokogiri.org/tutorials/installing_nokogiri.html#install-with-system-libraries
|
144
|
+
for specifics.)
|
147
145
|
|
148
|
-
|
149
|
-
(libxml2-dev/-devel is also required)
|
146
|
+
* libxml2 >=2.6.21 with iconv support (libxml2-dev/-devel is also required)
|
150
147
|
|
151
|
-
|
152
|
-
(libxslt-dev/-devel is also required)
|
148
|
+
* libxslt, built with and supported by the given libxml2 (libxslt-dev/-devel is also required)
|
153
149
|
|
154
150
|
|
155
151
|
## Encoding
|
@@ -191,6 +187,12 @@ explicitly setting the encoding to EUC-JP on the parser:
|
|
191
187
|
We've adopted the Contributor Covenant code of conduct, which you can read in full in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md).
|
192
188
|
|
193
189
|
|
190
|
+
## Semantic Versioning
|
191
|
+
|
192
|
+
[![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score/?dependency-name=nokogiri&package-manager=bundler)
|
193
|
+
|
194
|
+
Nokogiri follows [Semantic Versioning](https://semver.org/). See [`CHANGELOG.md`](CHANGELOG.md) for more details.
|
195
|
+
|
194
196
|
## License
|
195
197
|
|
196
198
|
This project is licensed under the terms of the MIT license.
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -24,6 +24,10 @@ def openbsd?
|
|
24
24
|
RbConfig::CONFIG['target_os'] =~ /openbsd/
|
25
25
|
end
|
26
26
|
|
27
|
+
def aix?
|
28
|
+
RbConfig::CONFIG["target_os"] =~ /aix/
|
29
|
+
end
|
30
|
+
|
27
31
|
def nix?
|
28
32
|
! (windows? || solaris? || darwin?)
|
29
33
|
end
|
@@ -419,7 +423,7 @@ if windows?
|
|
419
423
|
$CFLAGS << " -DXP_WIN -DXP_WIN32 -DUSE_INCLUDED_VASPRINTF"
|
420
424
|
end
|
421
425
|
|
422
|
-
if solaris?
|
426
|
+
if solaris? || aix?
|
423
427
|
$CFLAGS << " -DUSE_INCLUDED_VASPRINTF"
|
424
428
|
end
|
425
429
|
|
@@ -466,7 +470,7 @@ else
|
|
466
470
|
# The gem version constraint in the Rakefile is not respected at install time.
|
467
471
|
# Keep this version in sync with the one in the Rakefile !
|
468
472
|
require 'rubygems'
|
469
|
-
gem 'mini_portile2', '~> 2.
|
473
|
+
gem 'mini_portile2', '~> 2.5.0'
|
470
474
|
require 'mini_portile2'
|
471
475
|
message "Using mini_portile version #{MiniPortile::VERSION}\n"
|
472
476
|
|
@@ -486,50 +490,60 @@ else
|
|
486
490
|
url: "http://zlib.net/fossils/#{recipe.name}-#{recipe.version}.tar.gz",
|
487
491
|
sha256: dependencies["zlib"]["sha256"]
|
488
492
|
}]
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
493
|
+
if windows?
|
494
|
+
class << recipe
|
495
|
+
attr_accessor :cross_build_p
|
496
|
+
|
497
|
+
def configure
|
498
|
+
Dir.chdir work_path do
|
499
|
+
mk = File.read 'win32/Makefile.gcc'
|
500
|
+
File.open 'win32/Makefile.gcc', 'wb' do |f|
|
501
|
+
f.puts "BINARY_PATH = #{path}/bin"
|
502
|
+
f.puts "LIBRARY_PATH = #{path}/lib"
|
503
|
+
f.puts "INCLUDE_PATH = #{path}/include"
|
504
|
+
mk.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{host}-") if cross_build_p
|
505
|
+
f.puts mk
|
506
|
+
end
|
501
507
|
end
|
502
508
|
end
|
503
|
-
end
|
504
509
|
|
505
|
-
|
506
|
-
|
507
|
-
|
510
|
+
def configured?
|
511
|
+
Dir.chdir work_path do
|
512
|
+
!! (File.read('win32/Makefile.gcc') =~ /^BINARY_PATH/)
|
513
|
+
end
|
508
514
|
end
|
509
|
-
end
|
510
515
|
|
511
|
-
|
512
|
-
|
513
|
-
|
516
|
+
def compile
|
517
|
+
execute "compile", "make -f win32/Makefile.gcc"
|
518
|
+
end
|
514
519
|
|
515
|
-
|
516
|
-
|
520
|
+
def install
|
521
|
+
execute "install", "make -f win32/Makefile.gcc install"
|
522
|
+
end
|
523
|
+
end
|
524
|
+
recipe.cross_build_p = cross_build_p
|
525
|
+
else
|
526
|
+
class << recipe
|
527
|
+
def configure
|
528
|
+
execute "configure", ["env", "CHOST=#{host}", "CFLAGS=-fPIC #{ENV['CFLAGS']}", "./configure", "--static", configure_prefix]
|
529
|
+
end
|
517
530
|
end
|
518
531
|
end
|
519
|
-
recipe.cross_build_p = cross_build_p
|
520
532
|
end
|
521
533
|
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
534
|
+
unless nix?
|
535
|
+
libiconv_recipe = process_recipe("libiconv", dependencies["libiconv"]["version"], static_p, cross_build_p) do |recipe|
|
536
|
+
recipe.files = [{
|
537
|
+
url: "http://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz",
|
538
|
+
sha256: dependencies["libiconv"]["sha256"]
|
539
|
+
}]
|
540
|
+
recipe.configure_options += [
|
541
|
+
"CPPFLAGS=-Wall",
|
542
|
+
"CFLAGS=-O2 -g",
|
543
|
+
"CXXFLAGS=-O2 -g",
|
544
|
+
"LDFLAGS="
|
545
|
+
]
|
546
|
+
end
|
533
547
|
end
|
534
548
|
else
|
535
549
|
if darwin? && !have_header('iconv.h')
|
@@ -617,7 +631,6 @@ EOM
|
|
617
631
|
end
|
618
632
|
|
619
633
|
# Defining a macro that expands to a C string; double quotes are significant.
|
620
|
-
$CPPFLAGS << ' ' << "-DNOKOGIRI_#{recipe.name.upcase}_PATH=\"#{recipe.path}\"".inspect
|
621
634
|
$CPPFLAGS << ' ' << "-DNOKOGIRI_#{recipe.name.upcase}_PATCHES=\"#{recipe.patch_files.map { |path| File.basename(path) }.join(' ')}\"".inspect
|
622
635
|
|
623
636
|
case libname
|
data/ext/nokogiri/nokogiri.c
CHANGED
@@ -76,24 +76,30 @@ void Init_nokogiri()
|
|
76
76
|
mNokogiriHtmlSax = rb_define_module_under(mNokogiriHtml, "SAX");
|
77
77
|
|
78
78
|
rb_const_set( mNokogiri,
|
79
|
-
rb_intern("
|
79
|
+
rb_intern("LIBXML_COMPILED_VERSION"),
|
80
80
|
NOKOGIRI_STR_NEW2(LIBXML_DOTTED_VERSION)
|
81
81
|
);
|
82
82
|
rb_const_set( mNokogiri,
|
83
|
-
rb_intern("
|
83
|
+
rb_intern("LIBXML_LOADED_VERSION"),
|
84
84
|
NOKOGIRI_STR_NEW2(xmlParserVersion)
|
85
85
|
);
|
86
86
|
|
87
|
+
|
88
|
+
rb_const_set( mNokogiri,
|
89
|
+
rb_intern("LIBXSLT_COMPILED_VERSION"),
|
90
|
+
NOKOGIRI_STR_NEW2(LIBXSLT_DOTTED_VERSION)
|
91
|
+
);
|
92
|
+
rb_const_set( mNokogiri,
|
93
|
+
rb_intern("LIBXSLT_LOADED_VERSION"),
|
94
|
+
NOKOGIRI_STR_NEW2(xsltEngineVersion)
|
95
|
+
);
|
96
|
+
|
87
97
|
#ifdef NOKOGIRI_USE_PACKAGED_LIBRARIES
|
88
98
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_USE_PACKAGED_LIBRARIES"), Qtrue);
|
89
|
-
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATH"), NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXML2_PATH));
|
90
|
-
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATH"), NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXSLT_PATH));
|
91
99
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATCHES"), rb_str_split(NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXML2_PATCHES), " "));
|
92
100
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATCHES"), rb_str_split(NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXSLT_PATCHES), " "));
|
93
101
|
#else
|
94
102
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_USE_PACKAGED_LIBRARIES"), Qfalse);
|
95
|
-
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATH"), Qnil);
|
96
|
-
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATH"), Qnil);
|
97
103
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATCHES"), Qnil);
|
98
104
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATCHES"), Qnil);
|
99
105
|
#endif
|
data/ext/nokogiri/nokogiri.h
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
#ifndef NOKOGIRI_NATIVE
|
2
2
|
#define NOKOGIRI_NATIVE
|
3
3
|
|
4
|
+
#if _MSC_VER
|
5
|
+
#ifndef WIN32_LEAN_AND_MEAN
|
6
|
+
#define WIN32_LEAN_AND_MEAN
|
7
|
+
#endif /* WIN32_LEAN_AND_MEAN */
|
8
|
+
#ifndef WIN32
|
9
|
+
#define WIN32
|
10
|
+
#endif /* WIN32 */
|
11
|
+
#include <winsock2.h>
|
12
|
+
#include <ws2tcpip.h>
|
13
|
+
#include <windows.h>
|
14
|
+
#endif
|
15
|
+
|
4
16
|
#include <stdlib.h>
|
5
17
|
#include <string.h>
|
6
18
|
#include <assert.h>
|
@@ -29,6 +41,7 @@ int vasprintf (char **strp, const char *fmt, va_list ap);
|
|
29
41
|
#include <libxml/relaxng.h>
|
30
42
|
#include <libxml/xinclude.h>
|
31
43
|
#include <libxslt/extensions.h>
|
44
|
+
#include <libxslt/xsltconfig.h>
|
32
45
|
#include <libxml/c14n.h>
|
33
46
|
#include <ruby.h>
|
34
47
|
#include <ruby/st.h>
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#include <xml_document.h>
|
2
2
|
|
3
|
-
static int
|
3
|
+
static int dealloc_node_i2(xmlNodePtr key, xmlNodePtr node, xmlDocPtr doc)
|
4
4
|
{
|
5
5
|
switch(node->type) {
|
6
6
|
case XML_ATTRIBUTE_NODE:
|
@@ -20,6 +20,11 @@ static int dealloc_node_i(xmlNodePtr key, xmlNodePtr node, xmlDocPtr doc)
|
|
20
20
|
return ST_CONTINUE;
|
21
21
|
}
|
22
22
|
|
23
|
+
static int dealloc_node_i(st_data_t key, st_data_t node, st_data_t doc)
|
24
|
+
{
|
25
|
+
return dealloc_node_i2((xmlNodePtr)key, (xmlNodePtr)node, (xmlDocPtr)doc);
|
26
|
+
}
|
27
|
+
|
23
28
|
static void remove_private(xmlNodePtr node)
|
24
29
|
{
|
25
30
|
xmlNodePtr child;
|
@@ -38,6 +43,15 @@ static void remove_private(xmlNodePtr node)
|
|
38
43
|
node->_private = NULL;
|
39
44
|
}
|
40
45
|
|
46
|
+
static void mark(xmlDocPtr doc)
|
47
|
+
{
|
48
|
+
nokogiriTuplePtr tuple = (nokogiriTuplePtr)doc->_private;
|
49
|
+
if(tuple) {
|
50
|
+
rb_gc_mark(tuple->doc);
|
51
|
+
rb_gc_mark(tuple->node_cache);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
41
55
|
static void dealloc(xmlDocPtr doc)
|
42
56
|
{
|
43
57
|
st_table *node_hash;
|
@@ -588,7 +602,7 @@ VALUE Nokogiri_wrap_xml_document(VALUE klass, xmlDocPtr doc)
|
|
588
602
|
|
589
603
|
VALUE rb_doc = Data_Wrap_Struct(
|
590
604
|
klass ? klass : cNokogiriXmlDocument,
|
591
|
-
|
605
|
+
mark,
|
592
606
|
dealloc,
|
593
607
|
doc
|
594
608
|
);
|
data/ext/nokogiri/xml_io.c
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
static ID id_read, id_write;
|
4
4
|
|
5
|
-
VALUE read_check(VALUE
|
5
|
+
VALUE read_check(VALUE val) {
|
6
|
+
VALUE *args = (VALUE *)val;
|
6
7
|
return rb_funcall(args[0], id_read, 1, args[1]);
|
7
8
|
}
|
8
9
|
|
9
|
-
VALUE read_failed(
|
10
|
-
|
10
|
+
VALUE read_failed(VALUE arg, VALUE exc) {
|
11
|
+
return Qundef;
|
11
12
|
}
|
12
13
|
|
13
14
|
int io_read_callback(void * ctx, char * buffer, int len) {
|
@@ -30,12 +31,13 @@ int io_read_callback(void * ctx, char * buffer, int len) {
|
|
30
31
|
return (int)safe_len;
|
31
32
|
}
|
32
33
|
|
33
|
-
VALUE write_check(VALUE
|
34
|
+
VALUE write_check(VALUE val) {
|
35
|
+
VALUE *args = (VALUE *)val;
|
34
36
|
return rb_funcall(args[0], id_write, 1, args[1]);
|
35
37
|
}
|
36
38
|
|
37
|
-
VALUE write_failed(
|
38
|
-
|
39
|
+
VALUE write_failed(VALUE arg, VALUE exc) {
|
40
|
+
return Qundef;
|
39
41
|
}
|
40
42
|
|
41
43
|
int io_write_callback(void * ctx, char * buffer, int len) {
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -1332,6 +1332,25 @@ static VALUE line(VALUE self)
|
|
1332
1332
|
return INT2NUM(xmlGetLineNo(node));
|
1333
1333
|
}
|
1334
1334
|
|
1335
|
+
/*
|
1336
|
+
* call-seq:
|
1337
|
+
* line=(num)
|
1338
|
+
*
|
1339
|
+
* Sets the line for this Node. num must be less than 65535.
|
1340
|
+
*/
|
1341
|
+
static VALUE set_line(VALUE self, VALUE num)
|
1342
|
+
{
|
1343
|
+
xmlNodePtr node;
|
1344
|
+
Data_Get_Struct(self, xmlNode, node);
|
1345
|
+
|
1346
|
+
int value = NUM2INT(num);
|
1347
|
+
if (value < 65535) {
|
1348
|
+
node->line = value;
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
return num;
|
1352
|
+
}
|
1353
|
+
|
1335
1354
|
/*
|
1336
1355
|
* call-seq:
|
1337
1356
|
* add_namespace_definition(prefix, href)
|
@@ -1728,6 +1747,7 @@ void init_xml_node()
|
|
1728
1747
|
rb_define_method(klass, "create_external_subset", create_external_subset, 3);
|
1729
1748
|
rb_define_method(klass, "pointer_id", pointer_id, 0);
|
1730
1749
|
rb_define_method(klass, "line", line, 0);
|
1750
|
+
rb_define_method(klass, "line=", set_line, 1);
|
1731
1751
|
rb_define_method(klass, "content", get_native_content, 0);
|
1732
1752
|
rb_define_method(klass, "native_content=", set_native_content, 1);
|
1733
1753
|
rb_define_method(klass, "lang", get_lang, 0);
|
data/ext/nokogiri/xml_reader.c
CHANGED
@@ -28,35 +28,24 @@ static int has_attributes(xmlTextReaderPtr reader)
|
|
28
28
|
static void Nokogiri_xml_node_namespaces(xmlNodePtr node, VALUE attr_hash)
|
29
29
|
{
|
30
30
|
xmlNsPtr ns;
|
31
|
-
|
32
|
-
char *key ;
|
33
|
-
size_t keylen ;
|
31
|
+
VALUE key;
|
34
32
|
|
35
33
|
if (node->type != XML_ELEMENT_NODE) return ;
|
36
34
|
|
37
35
|
ns = node->nsDef;
|
38
36
|
while (ns != NULL) {
|
39
37
|
|
40
|
-
|
41
|
-
if (keylen > XMLNS_BUFFER_LEN) {
|
42
|
-
key = (char*)malloc(keylen) ;
|
43
|
-
} else {
|
44
|
-
key = buffer ;
|
45
|
-
}
|
46
|
-
|
38
|
+
key = rb_enc_str_new_cstr(XMLNS_PREFIX, rb_utf8_encoding());
|
47
39
|
if (ns->prefix) {
|
48
|
-
|
49
|
-
|
50
|
-
sprintf(key, "%s", XMLNS_PREFIX);
|
40
|
+
rb_str_cat_cstr(key, ":");
|
41
|
+
rb_str_cat_cstr(key, (const char*)ns->prefix);
|
51
42
|
}
|
52
43
|
|
44
|
+
key = rb_str_conv_enc(key, rb_utf8_encoding(), rb_default_internal_encoding());
|
53
45
|
rb_hash_aset(attr_hash,
|
54
|
-
|
46
|
+
key,
|
55
47
|
(ns->href ? NOKOGIRI_STR_NEW2(ns->href) : Qnil)
|
56
48
|
);
|
57
|
-
if (key != buffer) {
|
58
|
-
free(key);
|
59
|
-
}
|
60
49
|
ns = ns->next ;
|
61
50
|
}
|
62
51
|
}
|