nokogiri 1.13.7-java → 1.13.9-java
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/dependencies.yml +8 -8
- data/ext/java/nokogiri/XmlReader.java +8 -0
- data/ext/java/nokogiri/internals/ReaderNode.java +3 -2
- data/ext/nokogiri/extconf.rb +17 -3
- data/ext/nokogiri/xml_document.c +5 -1
- data/ext/nokogiri/xml_namespace.c +41 -5
- data/ext/nokogiri/xml_node.c +2 -2
- data/ext/nokogiri/xml_reader.c +52 -1
- data/ext/nokogiri/xml_xpath_context.c +3 -0
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version/constant.rb +1 -1
- data/lib/nokogiri/xml/reader.rb +6 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f30a64388fd65fe676b77a7c2ce550226b12ece1d7c8498c2fefb7b035beb2c
|
4
|
+
data.tar.gz: 9fb465b982130a628d134758cc147d5e66cf107a6315452fec01e8a2e854806a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7639c14bc8c475ddff4dce625e080ace25e36111bcbad8f2f02671cb4d8d339ee848b5ed362ae4d5ce6a2a75082036bb2b4ce447dd4cbf506bed6a0c1144cdab
|
7
|
+
data.tar.gz: 1972ce89fd6f61a78d2cf14072f01313cd6a849330dd4d5bc1c80bd2d9c57400681a225aa1a1f0092efd9a265fd97cc4b52c04bd47fb79ee0b3ff63a98cd0918
|
data/dependencies.yml
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
libxml2:
|
2
|
-
version: "2.
|
3
|
-
sha256: "
|
4
|
-
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.
|
2
|
+
version: "2.10.3"
|
3
|
+
sha256: "5d2cc3d78bec3dbe212a9d7fa629ada25a7da928af432c93060ff5c17ee28a9c"
|
4
|
+
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.3.sha256sum
|
5
5
|
|
6
6
|
libxslt:
|
7
|
-
version: "1.1.
|
8
|
-
sha256: "
|
9
|
-
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.
|
7
|
+
version: "1.1.37"
|
8
|
+
sha256: "3a4b27dc8027ccd6146725950336f1ec520928f320f144eb5fa7990ae6123ab4"
|
9
|
+
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.37.sha256sum
|
10
10
|
|
11
11
|
zlib:
|
12
|
-
version: "1.2.
|
13
|
-
sha256: "
|
12
|
+
version: "1.2.13"
|
13
|
+
sha256: "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30"
|
14
14
|
# SHA-256 hash provided on http://zlib.net/
|
15
15
|
|
16
16
|
libiconv:
|
@@ -141,9 +141,17 @@ public class XmlReader extends RubyObject
|
|
141
141
|
public IRubyObject
|
142
142
|
attribute_nodes(ThreadContext context)
|
143
143
|
{
|
144
|
+
context.runtime.getWarnings().warn("Reader#attribute_nodes is deprecated and will be removed in a future version of Nokogiri. Please use Reader#attribute_hash instead.");
|
144
145
|
return currentNode().getAttributesNodes();
|
145
146
|
}
|
146
147
|
|
148
|
+
@JRubyMethod
|
149
|
+
public IRubyObject
|
150
|
+
attribute_hash(ThreadContext context)
|
151
|
+
{
|
152
|
+
return currentNode().getAttributes(context);
|
153
|
+
}
|
154
|
+
|
147
155
|
@JRubyMethod(name = "attributes?")
|
148
156
|
public IRubyObject
|
149
157
|
attributes_p(ThreadContext context)
|
@@ -112,9 +112,10 @@ public abstract class ReaderNode
|
|
112
112
|
getAttributes(ThreadContext context)
|
113
113
|
{
|
114
114
|
final Ruby runtime = context.runtime;
|
115
|
-
if (attributeList == null) { return runtime.getNil(); }
|
116
115
|
RubyHash hash = RubyHash.newHash(runtime);
|
116
|
+
if (attributeList == null) { return hash; }
|
117
117
|
for (int i = 0; i < attributeList.length; i++) {
|
118
|
+
if (isNamespace(attributeList.names.get(i))) { continue; }
|
118
119
|
IRubyObject k = stringOrBlank(runtime, attributeList.names.get(i));
|
119
120
|
IRubyObject v = stringOrBlank(runtime, attributeList.values.get(i));
|
120
121
|
hash.fastASetCheckString(runtime, k, v); // hash.op_aset(context, k, v)
|
@@ -150,8 +151,8 @@ public abstract class ReaderNode
|
|
150
151
|
getNamespaces(ThreadContext context)
|
151
152
|
{
|
152
153
|
final Ruby runtime = context.runtime;
|
153
|
-
if (namespaces == null) { return runtime.getNil(); }
|
154
154
|
RubyHash hash = RubyHash.newHash(runtime);
|
155
|
+
if (namespaces == null) { return hash; }
|
155
156
|
for (Map.Entry<String, String> entry : namespaces.entrySet()) {
|
156
157
|
IRubyObject k = stringOrBlank(runtime, entry.getKey());
|
157
158
|
IRubyObject v = stringOrBlank(runtime, entry.getValue());
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -712,9 +712,17 @@ else
|
|
712
712
|
else
|
713
713
|
class << recipe
|
714
714
|
def configure
|
715
|
-
|
716
|
-
|
717
|
-
|
715
|
+
env = {}
|
716
|
+
env["CFLAGS"] = concat_flags(ENV["CFLAGS"], "-fPIC", "-g")
|
717
|
+
env["CHOST"] = host
|
718
|
+
execute("configure", ["./configure", "--static", configure_prefix], { env: env })
|
719
|
+
if darwin?
|
720
|
+
# needed as of zlib 1.2.13
|
721
|
+
Dir.chdir(work_path) do
|
722
|
+
makefile = File.read("Makefile").gsub(/^AR=.*$/, "AR=#{host}-libtool")
|
723
|
+
File.open("Makefile", "w") { |m| m.write(makefile) }
|
724
|
+
end
|
725
|
+
end
|
718
726
|
end
|
719
727
|
end
|
720
728
|
end
|
@@ -839,6 +847,11 @@ else
|
|
839
847
|
recipe.configure_options += ["RANLIB=/usr/bin/ranlib", "AR=/usr/bin/ar"]
|
840
848
|
end
|
841
849
|
|
850
|
+
if windows?
|
851
|
+
cflags = concat_flags(cflags, "-ULIBXSLT_STATIC", "-DIN_LIBXSLT")
|
852
|
+
cflags = concat_flags(cflags, "-ULIBEXSLT_STATIC", "-DIN_LIBEXSLT")
|
853
|
+
end
|
854
|
+
|
842
855
|
recipe.configure_options << if source_dir
|
843
856
|
"--config-cache"
|
844
857
|
else
|
@@ -974,6 +987,7 @@ have_func("xmlRelaxNGSetValidStructuredErrors") # introduced in libxml 2.6.21
|
|
974
987
|
have_func("xmlSchemaSetValidStructuredErrors") # introduced in libxml 2.6.23
|
975
988
|
have_func("xmlSchemaSetParserStructuredErrors") # introduced in libxml 2.6.23
|
976
989
|
have_func("rb_gc_location") # introduced in Ruby 2.7
|
990
|
+
have_func("rb_category_warning") # introduced in Ruby 3.0
|
977
991
|
|
978
992
|
have_func("vasprintf")
|
979
993
|
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -104,7 +104,11 @@ recursively_remove_namespaces_from_node(xmlNodePtr node)
|
|
104
104
|
(node->type == XML_XINCLUDE_START) ||
|
105
105
|
(node->type == XML_XINCLUDE_END)) &&
|
106
106
|
node->nsDef) {
|
107
|
-
|
107
|
+
xmlNsPtr curr = node->nsDef;
|
108
|
+
while (curr) {
|
109
|
+
noko_xml_document_pin_namespace(curr, node->doc);
|
110
|
+
curr = curr->next;
|
111
|
+
}
|
108
112
|
node->nsDef = NULL;
|
109
113
|
}
|
110
114
|
|
@@ -25,13 +25,15 @@
|
|
25
25
|
VALUE cNokogiriXmlNamespace ;
|
26
26
|
|
27
27
|
static void
|
28
|
-
|
28
|
+
_xml_namespace_dealloc(void *ptr)
|
29
29
|
{
|
30
30
|
/*
|
31
31
|
* this deallocator is only used for namespace nodes that are part of an xpath
|
32
32
|
* node set. see noko_xml_namespace_wrap().
|
33
33
|
*/
|
34
|
+
xmlNsPtr ns = ptr;
|
34
35
|
NOKOGIRI_DEBUG_START(ns) ;
|
36
|
+
|
35
37
|
if (ns->href) {
|
36
38
|
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(ns->href));
|
37
39
|
}
|
@@ -42,6 +44,36 @@ dealloc_namespace(xmlNsPtr ns)
|
|
42
44
|
NOKOGIRI_DEBUG_END(ns) ;
|
43
45
|
}
|
44
46
|
|
47
|
+
#ifdef HAVE_RB_GC_LOCATION
|
48
|
+
static void
|
49
|
+
_xml_namespace_update_references(void *ptr)
|
50
|
+
{
|
51
|
+
xmlNsPtr ns = ptr;
|
52
|
+
if (ns->_private) {
|
53
|
+
ns->_private = (void *)rb_gc_location((VALUE)ns->_private);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
#else
|
57
|
+
# define _xml_namespace_update_references 0
|
58
|
+
#endif
|
59
|
+
|
60
|
+
static const rb_data_type_t nokogiri_xml_namespace_type_with_dealloc = {
|
61
|
+
"Nokogiri/XMLNamespace/WithDealloc",
|
62
|
+
{0, _xml_namespace_dealloc, 0, _xml_namespace_update_references},
|
63
|
+
0, 0,
|
64
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
65
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
66
|
+
#endif
|
67
|
+
};
|
68
|
+
|
69
|
+
static const rb_data_type_t nokogiri_xml_namespace_type_without_dealloc = {
|
70
|
+
"Nokogiri/XMLNamespace/WithoutDealloc",
|
71
|
+
{0, 0, 0, _xml_namespace_update_references},
|
72
|
+
0, 0,
|
73
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
74
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
75
|
+
#endif
|
76
|
+
};
|
45
77
|
|
46
78
|
/*
|
47
79
|
* call-seq:
|
@@ -54,7 +86,7 @@ prefix(VALUE self)
|
|
54
86
|
{
|
55
87
|
xmlNsPtr ns;
|
56
88
|
|
57
|
-
|
89
|
+
Noko_Namespace_Get_Struct(self, xmlNs, ns);
|
58
90
|
if (!ns->prefix) { return Qnil; }
|
59
91
|
|
60
92
|
return NOKOGIRI_STR_NEW2(ns->prefix);
|
@@ -71,7 +103,7 @@ href(VALUE self)
|
|
71
103
|
{
|
72
104
|
xmlNsPtr ns;
|
73
105
|
|
74
|
-
|
106
|
+
Noko_Namespace_Get_Struct(self, xmlNs, ns);
|
75
107
|
if (!ns->href) { return Qnil; }
|
76
108
|
|
77
109
|
return NOKOGIRI_STR_NEW2(ns->href);
|
@@ -87,14 +119,18 @@ noko_xml_namespace_wrap(xmlNsPtr c_namespace, xmlDocPtr c_document)
|
|
87
119
|
}
|
88
120
|
|
89
121
|
if (c_document) {
|
90
|
-
rb_namespace =
|
122
|
+
rb_namespace = TypedData_Wrap_Struct(cNokogiriXmlNamespace,
|
123
|
+
&nokogiri_xml_namespace_type_without_dealloc,
|
124
|
+
c_namespace);
|
91
125
|
|
92
126
|
if (DOC_RUBY_OBJECT_TEST(c_document)) {
|
93
127
|
rb_iv_set(rb_namespace, "@document", DOC_RUBY_OBJECT(c_document));
|
94
128
|
rb_ary_push(DOC_NODE_CACHE(c_document), rb_namespace);
|
95
129
|
}
|
96
130
|
} else {
|
97
|
-
rb_namespace =
|
131
|
+
rb_namespace = TypedData_Wrap_Struct(cNokogiriXmlNamespace,
|
132
|
+
&nokogiri_xml_namespace_type_with_dealloc,
|
133
|
+
c_namespace);
|
98
134
|
}
|
99
135
|
|
100
136
|
c_namespace->_private = (void *)rb_namespace;
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -1353,7 +1353,7 @@ set_namespace(VALUE self, VALUE namespace)
|
|
1353
1353
|
Noko_Node_Get_Struct(self, xmlNode, node);
|
1354
1354
|
|
1355
1355
|
if (!NIL_P(namespace)) {
|
1356
|
-
|
1356
|
+
Noko_Namespace_Get_Struct(namespace, xmlNs, ns);
|
1357
1357
|
}
|
1358
1358
|
|
1359
1359
|
xmlSetNs(node, ns);
|
@@ -1806,7 +1806,7 @@ rb_xml_node_new(int argc, VALUE *argv, VALUE klass)
|
|
1806
1806
|
}
|
1807
1807
|
if (!rb_obj_is_kind_of(rb_document_node, cNokogiriXmlDocument)) {
|
1808
1808
|
// TODO: deprecate allowing Node
|
1809
|
-
|
1809
|
+
NOKO_WARN_DEPRECATION("Passing a Node as the second parameter to Node.new is deprecated. Please pass a Document instead, or prefer an alternative constructor like Node#add_child. This will become an error in a future release of Nokogiri.");
|
1810
1810
|
}
|
1811
1811
|
Noko_Node_Get_Struct(rb_document_node, xmlNode, c_document_node);
|
1812
1812
|
|
data/ext/nokogiri/xml_reader.c
CHANGED
@@ -31,6 +31,7 @@ has_attributes(xmlTextReaderPtr reader)
|
|
31
31
|
return (0);
|
32
32
|
}
|
33
33
|
|
34
|
+
// TODO: merge this function into the `namespaces` method implementation
|
34
35
|
static void
|
35
36
|
Nokogiri_xml_node_namespaces(xmlNodePtr node, VALUE attr_hash)
|
36
37
|
{
|
@@ -150,7 +151,11 @@ namespaces(VALUE self)
|
|
150
151
|
/*
|
151
152
|
:call-seq: attribute_nodes() → Array<Nokogiri::XML::Attr>
|
152
153
|
|
153
|
-
Get the attributes of the current node as an Array of Attr
|
154
|
+
Get the attributes of the current node as an Array of XML:Attr
|
155
|
+
|
156
|
+
⚠ This method is deprecated and unsafe to use. It will be removed in a future version of Nokogiri.
|
157
|
+
|
158
|
+
See related: #attribute_hash, #attributes
|
154
159
|
*/
|
155
160
|
static VALUE
|
156
161
|
rb_xml_reader_attribute_nodes(VALUE rb_reader)
|
@@ -160,6 +165,10 @@ rb_xml_reader_attribute_nodes(VALUE rb_reader)
|
|
160
165
|
VALUE attr_nodes;
|
161
166
|
int j;
|
162
167
|
|
168
|
+
// TODO: deprecated, remove in Nokogiri v1.15, see https://github.com/sparklemotion/nokogiri/issues/2598
|
169
|
+
// After removal, we can also remove all the "node_has_a_document" special handling from xml_node.c
|
170
|
+
NOKO_WARN_DEPRECATION("Reader#attribute_nodes is deprecated and will be removed in a future version of Nokogiri. Please use Reader#attribute_hash instead.");
|
171
|
+
|
163
172
|
Data_Get_Struct(rb_reader, xmlTextReader, c_reader);
|
164
173
|
|
165
174
|
if (! has_attributes(c_reader)) {
|
@@ -181,6 +190,47 @@ rb_xml_reader_attribute_nodes(VALUE rb_reader)
|
|
181
190
|
return attr_nodes;
|
182
191
|
}
|
183
192
|
|
193
|
+
/*
|
194
|
+
:call-seq: attribute_hash() → Hash<String ⇒ String>
|
195
|
+
|
196
|
+
Get the attributes of the current node as a Hash of names and values.
|
197
|
+
|
198
|
+
See related: #attributes and #namespaces
|
199
|
+
*/
|
200
|
+
static VALUE
|
201
|
+
rb_xml_reader_attribute_hash(VALUE rb_reader)
|
202
|
+
{
|
203
|
+
VALUE rb_attributes = rb_hash_new();
|
204
|
+
xmlTextReaderPtr c_reader;
|
205
|
+
xmlNodePtr c_node;
|
206
|
+
xmlAttrPtr c_property;
|
207
|
+
|
208
|
+
Data_Get_Struct(rb_reader, xmlTextReader, c_reader);
|
209
|
+
|
210
|
+
if (!has_attributes(c_reader)) {
|
211
|
+
return rb_attributes;
|
212
|
+
}
|
213
|
+
|
214
|
+
c_node = xmlTextReaderExpand(c_reader);
|
215
|
+
c_property = c_node->properties;
|
216
|
+
while (c_property != NULL) {
|
217
|
+
VALUE rb_name = NOKOGIRI_STR_NEW2(c_property->name);
|
218
|
+
VALUE rb_value = Qnil;
|
219
|
+
xmlChar *c_value = xmlNodeGetContent((xmlNode *)c_property);
|
220
|
+
|
221
|
+
if (c_value) {
|
222
|
+
rb_value = NOKOGIRI_STR_NEW2(c_value);
|
223
|
+
xmlFree(c_value);
|
224
|
+
}
|
225
|
+
|
226
|
+
rb_hash_aset(rb_attributes, rb_name, rb_value);
|
227
|
+
|
228
|
+
c_property = c_property->next;
|
229
|
+
}
|
230
|
+
|
231
|
+
return rb_attributes;
|
232
|
+
}
|
233
|
+
|
184
234
|
/*
|
185
235
|
* call-seq:
|
186
236
|
* attribute_at(index)
|
@@ -696,6 +746,7 @@ noko_init_xml_reader()
|
|
696
746
|
rb_define_method(cNokogiriXmlReader, "attribute_at", attribute_at, 1);
|
697
747
|
rb_define_method(cNokogiriXmlReader, "attribute_count", attribute_count, 0);
|
698
748
|
rb_define_method(cNokogiriXmlReader, "attribute_nodes", rb_xml_reader_attribute_nodes, 0);
|
749
|
+
rb_define_method(cNokogiriXmlReader, "attribute_hash", rb_xml_reader_attribute_hash, 0);
|
699
750
|
rb_define_method(cNokogiriXmlReader, "attributes?", attributes_eh, 0);
|
700
751
|
rb_define_method(cNokogiriXmlReader, "base_uri", rb_xml_reader_base_uri, 0);
|
701
752
|
rb_define_method(cNokogiriXmlReader, "default?", default_eh, 0);
|
@@ -373,7 +373,10 @@ new (VALUE klass, VALUE nodeobj)
|
|
373
373
|
|
374
374
|
Noko_Node_Get_Struct(nodeobj, xmlNode, node);
|
375
375
|
|
376
|
+
#if LIBXML_VERSION < 21000
|
377
|
+
/* deprecated in 40483d0 */
|
376
378
|
xmlXPathInit();
|
379
|
+
#endif
|
377
380
|
|
378
381
|
ctx = xmlXPathNewContext(node->doc);
|
379
382
|
ctx->node = node;
|
data/lib/nokogiri/nokogiri.jar
CHANGED
Binary file
|
data/lib/nokogiri/xml/reader.rb
CHANGED
@@ -83,16 +83,14 @@ module Nokogiri
|
|
83
83
|
end
|
84
84
|
private :initialize
|
85
85
|
|
86
|
-
# Get the attributes of the current node as a Hash
|
86
|
+
# Get the attributes and namespaces of the current node as a Hash.
|
87
87
|
#
|
88
|
-
#
|
88
|
+
# This is the union of Reader#attribute_hash and Reader#namespaces
|
89
|
+
#
|
90
|
+
# [Returns]
|
91
|
+
# (Hash<String, String>) Attribute names and values, and namespace prefixes and hrefs.
|
89
92
|
def attributes
|
90
|
-
|
91
|
-
hash[node.name] = node.to_s
|
92
|
-
end
|
93
|
-
ns = namespaces
|
94
|
-
attrs_hash.merge!(ns) if ns
|
95
|
-
attrs_hash
|
93
|
+
attribute_hash.merge(namespaces)
|
96
94
|
end
|
97
95
|
|
98
96
|
###
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.9
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
@@ -20,7 +20,7 @@ authors:
|
|
20
20
|
autorequire:
|
21
21
|
bindir: bin
|
22
22
|
cert_chain: []
|
23
|
-
date: 2022-
|
23
|
+
date: 2022-10-18 00:00:00.000000000 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
requirement: !ruby/object:Gem::Requirement
|