nokogiri 1.13.7-java → 1.13.8-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/ext/java/nokogiri/XmlReader.java +8 -0
- data/ext/java/nokogiri/internals/ReaderNode.java +3 -2
- data/ext/nokogiri/extconf.rb +1 -0
- data/ext/nokogiri/xml_node.c +1 -1
- data/ext/nokogiri/xml_reader.c +52 -1
- 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: ada61d4741dbf0af27d1f10e368ae64f8f26f22bcd2476d8d7befc163ad49d6c
|
4
|
+
data.tar.gz: 1a6a10073ade74d223c05b9afac779e6ce9aec5db2d105979a21184cc3448fb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1c2231c15b6a945424f161881fa4cd0ca9c50cb3f6cc9c3df0447d7705601ebd816ab9a597f6bb3f7de8382f880e8c0c66829bbc3eef7b0541a90eed53a33c9
|
7
|
+
data.tar.gz: a0830be00451175c4eccefe67eeefc47bfe7ec19adc0e05e2673fb5f80a87f382912c6b90e11e2029c8c7757d8f1eaec81102a76a7bf3f8ea2f55450e3d4dd26
|
@@ -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
@@ -974,6 +974,7 @@ have_func("xmlRelaxNGSetValidStructuredErrors") # introduced in libxml 2.6.21
|
|
974
974
|
have_func("xmlSchemaSetValidStructuredErrors") # introduced in libxml 2.6.23
|
975
975
|
have_func("xmlSchemaSetParserStructuredErrors") # introduced in libxml 2.6.23
|
976
976
|
have_func("rb_gc_location") # introduced in Ruby 2.7
|
977
|
+
have_func("rb_category_warning") # introduced in Ruby 3.0
|
977
978
|
|
978
979
|
have_func("vasprintf")
|
979
980
|
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -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);
|
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.8
|
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-07-
|
23
|
+
date: 2022-07-23 00:00:00.000000000 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
requirement: !ruby/object:Gem::Requirement
|