nokogiri 1.6.7.2-x86-mingw32 → 1.6.8.rc1-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/.travis.yml +12 -9
- data/CHANGELOG.ja.rdoc +18 -0
- data/CHANGELOG.rdoc +12 -7
- data/CONTRIBUTING.md +42 -0
- data/Gemfile +1 -1
- data/Manifest.txt +6 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/nokogiri +2 -2
- data/dependencies.yml +1 -1
- data/ext/nokogiri/extconf.rb +3 -3
- data/ext/nokogiri/nokogiri.c +0 -7
- data/ext/nokogiri/nokogiri.h +1 -34
- data/ext/nokogiri/xml_document.c +2 -4
- data/ext/nokogiri/xml_namespace.c +56 -17
- data/ext/nokogiri/xml_node.c +12 -36
- data/ext/nokogiri/xml_node_set.c +169 -143
- data/ext/nokogiri/xml_node_set.h +3 -4
- data/ext/nokogiri/xml_sax_parser.c +2 -5
- data/ext/nokogiri/xml_syntax_error.c +0 -4
- data/ext/nokogiri/xml_syntax_error.h +0 -1
- data/ext/nokogiri/xml_xpath_context.c +9 -18
- data/lib/nokogiri.rb +3 -0
- data/lib/nokogiri/1.9/nokogiri.so +0 -0
- data/lib/nokogiri/2.0/nokogiri.so +0 -0
- data/lib/nokogiri/2.1/nokogiri.so +0 -0
- data/lib/nokogiri/2.2/nokogiri.so +0 -0
- data/lib/nokogiri/css/parser.rb +8 -2
- data/lib/nokogiri/css/parser.y +7 -2
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/document.rb +7 -1
- data/lib/nokogiri/xml/dtd.rb +4 -4
- data/lib/nokogiri/xml/node.rb +2 -2
- data/test/css/test_parser.rb +7 -1
- data/test/files/GH_1042.html +18 -0
- data/test/files/namespace_pressure_test.xml +1684 -0
- data/test/files/tlm.html +2 -1
- data/test/html/sax/test_parser.rb +2 -2
- data/test/html/test_document.rb +18 -8
- data/test/html/test_document_encoding.rb +46 -54
- data/test/html/test_document_fragment.rb +21 -22
- data/test/html/test_node.rb +16 -0
- data/test/html/test_node_encoding.rb +12 -14
- data/test/namespaces/test_namespaces_in_parsed_doc.rb +14 -0
- data/test/test_reader.rb +19 -0
- data/test/test_xslt_transforms.rb +5 -3
- data/test/xml/sax/test_parser.rb +36 -39
- data/test/xml/test_document.rb +7 -2
- data/test/xml/test_document_encoding.rb +14 -16
- data/test/xml/test_dtd_encoding.rb +0 -2
- data/test/xml/test_node_encoding.rb +78 -80
- data/test/xml/test_reader_encoding.rb +100 -102
- data/test/xslt/test_exception_handling.rb +1 -1
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1390d122b49e1f336bd790d13470a57250ddff74
|
4
|
+
data.tar.gz: e8087f8117b56fa1eed92c18c7a790253cd733a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90c59fca34dd0baf8d0ade07457a6e6a38604414773472b2b3d5c7ff82544e985b3f246e1d99b3e734868c840ed40651153289672f64d5d7ea91a8b297317c88
|
7
|
+
data.tar.gz: 07121f8206a2f11d55337989c8cd3bea82992f69d6799f952ad94aa81e231193c76b9972f181ca9c2bd436e61143375997e549fd1b66ba57c16e91a75ca25de7
|
data/.travis.yml
CHANGED
@@ -4,13 +4,13 @@ sudo: false
|
|
4
4
|
|
5
5
|
rvm:
|
6
6
|
- ruby-1.9.2
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
7
|
+
- 1.9.3
|
8
|
+
- 2.0
|
9
|
+
- 2.1
|
10
|
+
- 2.2.3
|
11
11
|
- jruby-19mode
|
12
|
-
- jruby-1.7.
|
13
|
-
- jruby-9.0.
|
12
|
+
- jruby-1.7.23
|
13
|
+
- jruby-9.0.4.0
|
14
14
|
- rbx-19mode
|
15
15
|
- rbx-2
|
16
16
|
|
@@ -25,9 +25,9 @@ matrix:
|
|
25
25
|
- os: osx
|
26
26
|
rvm: jruby-19mode
|
27
27
|
- os: osx
|
28
|
-
rvm: jruby-1.7.
|
28
|
+
rvm: jruby-1.7.23
|
29
29
|
- os: osx
|
30
|
-
rvm: jruby-9.0.
|
30
|
+
rvm: jruby-9.0.4.0
|
31
31
|
- os: osx
|
32
32
|
rvm: rbx-19mode
|
33
33
|
- os: osx
|
@@ -37,5 +37,8 @@ notifications:
|
|
37
37
|
irc:
|
38
38
|
channels:
|
39
39
|
- "chat.freenode.net#nokogiri"
|
40
|
-
|
40
|
+
on_success: change
|
41
|
+
on_failure: always
|
42
|
+
template:
|
43
|
+
- "%{repository} (%{branch}:%{commit} by %{author}): %{message} (%{build_url})"
|
41
44
|
skip_join: true
|
data/CHANGELOG.ja.rdoc
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
=== 1.6.8 / 未リリース
|
2
|
+
|
3
|
+
==== セキュリティ
|
4
|
+
|
5
|
+
* (MRI) Bundled Libxml2 is upgraded to 2.9.3, which fixes a series of security issues. See https://mail.gnome.org/archives/xml/2015-November/msg00012.html
|
6
|
+
|
7
|
+
|
8
|
+
==== バグ修正
|
9
|
+
|
10
|
+
* [JRuby] fix load errors when deploying to JRuby/Torquebox (#1114) (Thanks, @atambo!)
|
11
|
+
* [JRuby] fix NPE when inspecting nodes returned by NodeSet#drop (#1042) (Thanks, @mkristian!)
|
12
|
+
* [JRuby] fix nil attriubte node's namespace in reader (#1327) (Thanks, @codekitchen!)
|
13
|
+
* [MRI] fix assertion failure while accessing attribute node's namespace in reader (#843) (Thanks, @2potatocakes!)
|
14
|
+
* [MRI] fix issue with GCing namespace nodes returned in an xpath query. (#1155)
|
15
|
+
* unescape special characters in CSS queries (#1303) (Thanks, @twalpole!)
|
16
|
+
* consistently handle empty documents (#1349)
|
17
|
+
|
18
|
+
|
1
19
|
=== 1.6.7.1 / 2015年12月16日
|
2
20
|
|
3
21
|
This version pulls in several upstream patches to the vendored libxml2 and libxslt to address:
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,12 +1,19 @@
|
|
1
|
-
=== 1.6.
|
1
|
+
=== 1.6.8 / unreleased
|
2
2
|
|
3
|
-
|
3
|
+
==== Security Note
|
4
4
|
|
5
|
-
|
5
|
+
* (MRI) Bundled Libxml2 is upgraded to 2.9.3, which fixes a series of security issues. See https://mail.gnome.org/archives/xml/2015-November/msg00012.html
|
6
6
|
|
7
|
-
Ubuntu classifies this as "Priority: Low", RedHat classifies this as "Impact: Moderate", and NIST classifies this as "Severity: 5.0 (MEDIUM)".
|
8
7
|
|
9
|
-
|
8
|
+
==== Bug Fixes
|
9
|
+
|
10
|
+
* [JRuby] fix load errors when deploying to JRuby/Torquebox (#1114) (Thanks, @atambo!)
|
11
|
+
* [JRuby] fix NPE when inspecting nodes returned by NodeSet#drop (#1042) (Thanks, @mkristian!)
|
12
|
+
* [JRuby] fix nil attriubte node's namespace in reader (#1327) (Thanks, @codekitchen!)
|
13
|
+
* [MRI] fix assertion failure while accessing attribute node's namespace in reader (#843) (Thanks, @2potatocakes!)
|
14
|
+
* [MRI] fix issue with GCing namespace nodes returned in an xpath query. (#1155)
|
15
|
+
* unescape special characters in CSS queries (#1303) (Thanks, @twalpole!)
|
16
|
+
* consistently handle empty documents (#1349)
|
10
17
|
|
11
18
|
|
12
19
|
=== 1.6.7.1 / 2015-12-16
|
@@ -22,8 +29,6 @@ This version pulls in several upstream patches to the vendored libxml2 and libxs
|
|
22
29
|
CVE-2015-8242
|
23
30
|
CVE-2015-8317
|
24
31
|
|
25
|
-
These CVEs are all low or medium priority according to Canonical, however NIST NVD gives CVE-2015-5312 a high severity score.
|
26
|
-
|
27
32
|
See also http://www.ubuntu.com/usn/usn-2834-1/
|
28
33
|
|
29
34
|
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Issue and Pull Request Guidlines
|
2
|
+
|
3
|
+
Thank you for getting involved in making Nokogiri better!
|
4
|
+
|
5
|
+
|
6
|
+
## Code of Conduct
|
7
|
+
|
8
|
+
For best results, be nice. Remember that Nokogiri maintainers are
|
9
|
+
volunteers, and treat them with respect.
|
10
|
+
|
11
|
+
Do not act entitled to service. Do not be rude. Do not use judgmental
|
12
|
+
or foul language.
|
13
|
+
|
14
|
+
The maintainers reserve the right to delete comments that are rude, or
|
15
|
+
that contain foul language. The maintainers reserve the right to
|
16
|
+
delete comments that they deem harassing or offensive.
|
17
|
+
|
18
|
+
|
19
|
+
## Issues
|
20
|
+
|
21
|
+
Please read the
|
22
|
+
["Getting Help" tutorial](http://www.nokogiri.org/tutorials/getting_help.html)
|
23
|
+
at the [nokogiri.org](http://nokogiri.org) site.
|
24
|
+
|
25
|
+
If you're reporting an issue, it must contain:
|
26
|
+
|
27
|
+
* Example code that reproduces the **observed** behavior.
|
28
|
+
* An explanation of what the **expected** behavior is.
|
29
|
+
|
30
|
+
That's it. If you don't provide that information, we'll ask you for
|
31
|
+
it, tag the story "needs more information", and then after a time will
|
32
|
+
close it if the information isn't provided.
|
33
|
+
|
34
|
+
|
35
|
+
## Pull Requests
|
36
|
+
|
37
|
+
Pull requests must always contain a test to prevent
|
38
|
+
regressions. Preferably, the test should demonstrate the __intent__ of
|
39
|
+
the code.
|
40
|
+
|
41
|
+
We may ask you for clarification if we don't understand the intent of
|
42
|
+
the change.
|
data/Gemfile
CHANGED
data/Manifest.txt
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
.travis.yml
|
6
6
|
CHANGELOG.ja.rdoc
|
7
7
|
CHANGELOG.rdoc
|
8
|
+
CONTRIBUTING.md
|
8
9
|
C_CODING_STYLE.rdoc
|
9
10
|
Gemfile
|
10
11
|
LICENSE.txt
|
@@ -241,7 +242,10 @@ lib/nokogiri/xml/xpath/syntax_error.rb
|
|
241
242
|
lib/nokogiri/xml/xpath_context.rb
|
242
243
|
lib/nokogiri/xslt.rb
|
243
244
|
lib/nokogiri/xslt/stylesheet.rb
|
245
|
+
lib/serializer.jar
|
246
|
+
lib/xalan.jar
|
244
247
|
lib/xercesImpl.jar
|
248
|
+
lib/xml-apis.jar
|
245
249
|
lib/xsd/xmlparser/nokogiri.rb
|
246
250
|
patches/sort-patches-by-date
|
247
251
|
suppressions/README.txt
|
@@ -256,6 +260,7 @@ test/css/test_tokenizer.rb
|
|
256
260
|
test/css/test_xpath_visitor.rb
|
257
261
|
test/decorators/test_slop.rb
|
258
262
|
test/files/2ch.html
|
263
|
+
test/files/GH_1042.html
|
259
264
|
test/files/address_book.rlx
|
260
265
|
test/files/address_book.xml
|
261
266
|
test/files/atom.xml
|
@@ -268,6 +273,7 @@ test/files/exslt.xml
|
|
268
273
|
test/files/exslt.xslt
|
269
274
|
test/files/foo/foo.xsd
|
270
275
|
test/files/metacharset.html
|
276
|
+
test/files/namespace_pressure_test.xml
|
271
277
|
test/files/noencoding.html
|
272
278
|
test/files/po.xml
|
273
279
|
test/files/po.xsd
|
data/README.md
CHANGED
@@ -121,7 +121,7 @@ Nokogiri is a large library, but here is example usage for parsing and examining
|
|
121
121
|
gem, but if you want to use the system versions:
|
122
122
|
|
123
123
|
* at install time, set the environment variable
|
124
|
-
`
|
124
|
+
`NOKOGIRI_USE_SYSTEM_LIBRARIES` or else use the
|
125
125
|
`--use-system-libraries` argument. (See
|
126
126
|
http://nokogiri.org/tutorials/installing_nokogiri.html#using_your_system_libraries
|
127
127
|
for specifics.)
|
data/Rakefile
CHANGED
data/bin/nokogiri
CHANGED
@@ -41,9 +41,9 @@ opts = OptionParser.new do |opts|
|
|
41
41
|
opts.define_head "Usage: nokogiri <uri|path> [options]"
|
42
42
|
opts.separator ""
|
43
43
|
opts.separator "Examples:"
|
44
|
-
opts.separator " nokogiri
|
44
|
+
opts.separator " nokogiri https://www.ruby-lang.org/"
|
45
45
|
opts.separator " nokogiri ./public/index.html"
|
46
|
-
opts.separator " curl -s http://nokogiri.org | nokogiri -e'p $_.css(\"h1\").length'"
|
46
|
+
opts.separator " curl -s http://www.nokogiri.org | nokogiri -e'p $_.css(\"h1\").length'"
|
47
47
|
opts.separator ""
|
48
48
|
opts.separator "Options:"
|
49
49
|
|
data/dependencies.yml
CHANGED
data/ext/nokogiri/extconf.rb
CHANGED
@@ -381,10 +381,10 @@ when using_system_libraries?
|
|
381
381
|
#endif
|
382
382
|
SRC
|
383
383
|
|
384
|
-
try_cpp(<<-SRC) or warn "libxml2 version 2.9.
|
384
|
+
try_cpp(<<-SRC) or warn "libxml2 version 2.9.3 or later is highly recommended, but proceeding anyway."
|
385
385
|
#include <libxml/xmlversion.h>
|
386
386
|
|
387
|
-
#if LIBXML_VERSION <
|
387
|
+
#if LIBXML_VERSION < 20903
|
388
388
|
#error libxml2 is too old
|
389
389
|
#endif
|
390
390
|
SRC
|
@@ -393,7 +393,7 @@ else
|
|
393
393
|
|
394
394
|
# The gem version constraint in the Rakefile is not respected at install time.
|
395
395
|
# Keep this version in sync with the one in the Rakefile !
|
396
|
-
gem "mini_portile2", "~> 2.0.0
|
396
|
+
gem "mini_portile2", "~> 2.0.0"
|
397
397
|
require 'mini_portile2'
|
398
398
|
message "Using mini_portile version #{MiniPortile::VERSION}\n"
|
399
399
|
|
data/ext/nokogiri/nokogiri.c
CHANGED
@@ -28,17 +28,10 @@ int vasprintf (char **strp, const char *fmt, va_list ap)
|
|
28
28
|
}
|
29
29
|
#endif
|
30
30
|
|
31
|
-
#ifdef USING_SYSTEM_ALLOCATOR_LIBRARY /* Ruby Enterprise Edition with tcmalloc */
|
32
|
-
void vasprintf_free (void *p)
|
33
|
-
{
|
34
|
-
system_free(p);
|
35
|
-
}
|
36
|
-
#else
|
37
31
|
void vasprintf_free (void *p)
|
38
32
|
{
|
39
33
|
free(p);
|
40
34
|
}
|
41
|
-
#endif
|
42
35
|
|
43
36
|
#ifdef HAVE_RUBY_UTIL_H
|
44
37
|
#include "ruby/util.h"
|
data/ext/nokogiri/nokogiri.h
CHANGED
@@ -31,12 +31,8 @@ int vasprintf (char **strp, const char *fmt, va_list ap);
|
|
31
31
|
#include <libxslt/extensions.h>
|
32
32
|
#include <libxml/c14n.h>
|
33
33
|
#include <ruby.h>
|
34
|
-
|
35
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
36
34
|
#include <ruby/st.h>
|
37
|
-
#
|
38
|
-
#include <st.h>
|
39
|
-
#endif
|
35
|
+
#include <ruby/encoding.h>
|
40
36
|
|
41
37
|
#ifndef UNUSED
|
42
38
|
# if defined(__GNUC__)
|
@@ -56,25 +52,12 @@ int vasprintf (char **strp, const char *fmt, va_list ap);
|
|
56
52
|
# endif
|
57
53
|
#endif
|
58
54
|
|
59
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
60
|
-
|
61
|
-
#include <ruby/encoding.h>
|
62
|
-
|
63
55
|
#define NOKOGIRI_STR_NEW2(str) \
|
64
56
|
NOKOGIRI_STR_NEW(str, strlen((const char *)(str)))
|
65
57
|
|
66
58
|
#define NOKOGIRI_STR_NEW(str, len) \
|
67
59
|
rb_external_str_new_with_enc((const char *)(str), (long)(len), rb_utf8_encoding())
|
68
60
|
|
69
|
-
#else
|
70
|
-
|
71
|
-
#define NOKOGIRI_STR_NEW2(str) \
|
72
|
-
rb_str_new2((const char *)(str))
|
73
|
-
|
74
|
-
#define NOKOGIRI_STR_NEW(str, len) \
|
75
|
-
rb_str_new((const char *)(str), (long)(len))
|
76
|
-
#endif
|
77
|
-
|
78
61
|
#define RBSTR_OR_QNIL(_str) \
|
79
62
|
(_str ? NOKOGIRI_STR_NEW2(_str) : Qnil)
|
80
63
|
|
@@ -135,22 +118,6 @@ void nokogiri_root_nsdef(xmlNsPtr, xmlDocPtr);
|
|
135
118
|
|
136
119
|
#endif
|
137
120
|
|
138
|
-
#ifndef RSTRING_PTR
|
139
|
-
#define RSTRING_PTR(s) (RSTRING(s)->ptr)
|
140
|
-
#endif
|
141
|
-
|
142
|
-
#ifndef RSTRING_LEN
|
143
|
-
#define RSTRING_LEN(s) (RSTRING(s)->len)
|
144
|
-
#endif
|
145
|
-
|
146
|
-
#ifndef RARRAY_PTR
|
147
|
-
#define RARRAY_PTR(a) RARRAY(a)->ptr
|
148
|
-
#endif
|
149
|
-
|
150
|
-
#ifndef RARRAY_LEN
|
151
|
-
#define RARRAY_LEN(a) RARRAY(a)->len
|
152
|
-
#endif
|
153
|
-
|
154
121
|
#ifndef __builtin_expect
|
155
122
|
# if defined(__GNUC__)
|
156
123
|
# define __builtin_expect(expr, c) __builtin_expect((long)(expr), (long)(c))
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -322,22 +322,20 @@ static VALUE duplicate_document(int argc, VALUE *argv, VALUE self)
|
|
322
322
|
xmlDocPtr doc, dup;
|
323
323
|
VALUE copy;
|
324
324
|
VALUE level;
|
325
|
-
VALUE error_list
|
325
|
+
VALUE error_list;
|
326
326
|
|
327
327
|
if(rb_scan_args(argc, argv, "01", &level) == 0)
|
328
328
|
level = INT2NUM((long)1);
|
329
329
|
|
330
330
|
Data_Get_Struct(self, xmlDoc, doc);
|
331
331
|
|
332
|
-
xmlResetLastError();
|
333
|
-
xmlSetStructuredErrorFunc((void *)error_list, Nokogiri_error_array_pusher);
|
334
332
|
dup = xmlCopyDoc(doc, (int)NUM2INT(level));
|
335
|
-
xmlSetStructuredErrorFunc(NULL, NULL);
|
336
333
|
|
337
334
|
if(dup == NULL) return Qnil;
|
338
335
|
|
339
336
|
dup->type = doc->type;
|
340
337
|
copy = Nokogiri_wrap_xml_document(rb_obj_class(self), dup);
|
338
|
+
error_list = rb_iv_get(self, "@errors");
|
341
339
|
rb_iv_set(copy, "@errors", error_list);
|
342
340
|
return copy ;
|
343
341
|
}
|
@@ -2,6 +2,34 @@
|
|
2
2
|
|
3
3
|
VALUE cNokogiriXmlNamespace ;
|
4
4
|
|
5
|
+
static void dealloc_namespace(xmlNsPtr ns)
|
6
|
+
{
|
7
|
+
/*
|
8
|
+
*
|
9
|
+
* this deallocator is only used for namespace nodes that are part of an xpath
|
10
|
+
* node set.
|
11
|
+
*
|
12
|
+
* see Nokogiri_wrap_xml_namespace() for more details.
|
13
|
+
*
|
14
|
+
*/
|
15
|
+
NOKOGIRI_DEBUG_START(ns) ;
|
16
|
+
if (ns->href) {
|
17
|
+
xmlFree((xmlChar *)ns->href);
|
18
|
+
}
|
19
|
+
if (ns->prefix) {
|
20
|
+
xmlFree((xmlChar *)ns->prefix);
|
21
|
+
}
|
22
|
+
xmlFree(ns);
|
23
|
+
NOKOGIRI_DEBUG_END(ns) ;
|
24
|
+
}
|
25
|
+
|
26
|
+
|
27
|
+
int Nokogiri_namespace_eh(xmlNodePtr node)
|
28
|
+
{
|
29
|
+
return (node->type == XML_NAMESPACE_DECL);
|
30
|
+
}
|
31
|
+
|
32
|
+
|
5
33
|
/*
|
6
34
|
* call-seq:
|
7
35
|
* prefix
|
@@ -34,37 +62,48 @@ static VALUE href(VALUE self)
|
|
34
62
|
return NOKOGIRI_STR_NEW2(ns->href);
|
35
63
|
}
|
36
64
|
|
65
|
+
static int part_of_an_xpath_node_set_eh(xmlNsPtr node)
|
66
|
+
{
|
67
|
+
return (node->next && ! Nokogiri_namespace_eh(node->next));
|
68
|
+
}
|
69
|
+
|
37
70
|
VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node)
|
38
71
|
{
|
39
72
|
VALUE ns, document, node_cache;
|
40
73
|
|
41
|
-
assert(doc->
|
74
|
+
assert(doc->type == XML_DOCUMENT_NODE || doc->type == XML_HTML_DOCUMENT_NODE);
|
42
75
|
|
43
|
-
if(node->_private)
|
44
|
-
return (VALUE)node->_private;
|
76
|
+
if (node->_private) return (VALUE)node->_private;
|
45
77
|
|
46
|
-
|
78
|
+
if (doc->type == XML_DOCUMENT_FRAG_NODE) doc = doc->doc;
|
47
79
|
|
48
|
-
|
49
|
-
|
50
|
-
node_cache = rb_iv_get(document, "@node_cache");
|
51
|
-
rb_ary_push(node_cache, ns);
|
80
|
+
ns = Data_Wrap_Struct(cNokogiriXmlNamespace, 0, 0, node);
|
52
81
|
|
53
|
-
|
82
|
+
if (DOC_RUBY_OBJECT_TEST(doc)) {
|
83
|
+
document = DOC_RUBY_OBJECT(doc);
|
84
|
+
|
85
|
+
if (part_of_an_xpath_node_set_eh(node)) {
|
86
|
+
/*
|
87
|
+
* this is a duplicate returned as part of an xpath query node set, and so
|
88
|
+
* we need to make sure we manage this memory.
|
89
|
+
*
|
90
|
+
* see comments in xml_node_set.c for more details.
|
91
|
+
*/
|
92
|
+
ns = Data_Wrap_Struct(cNokogiriXmlNamespace, 0, dealloc_namespace, node);
|
93
|
+
} else {
|
94
|
+
ns = Data_Wrap_Struct(cNokogiriXmlNamespace, 0, 0, node);
|
95
|
+
node_cache = rb_iv_get(document, "@node_cache");
|
96
|
+
rb_ary_push(node_cache, ns);
|
97
|
+
}
|
98
|
+
|
99
|
+
rb_iv_set(ns, "@document", document);
|
100
|
+
}
|
54
101
|
|
55
102
|
node->_private = (void *)ns;
|
56
103
|
|
57
104
|
return ns;
|
58
105
|
}
|
59
106
|
|
60
|
-
VALUE Nokogiri_wrap_xml_namespace2(VALUE document, xmlNsPtr node)
|
61
|
-
{
|
62
|
-
xmlDocPtr doc;
|
63
|
-
Data_Get_Struct(document, xmlDoc, doc) ;
|
64
|
-
return Nokogiri_wrap_xml_namespace(doc, node);
|
65
|
-
}
|
66
|
-
|
67
|
-
|
68
107
|
void init_xml_namespace()
|
69
108
|
{
|
70
109
|
VALUE nokogiri = rb_define_module("Nokogiri");
|