nokogiri 1.15.2-java → 1.15.4-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 +3 -3
- data/ext/java/nokogiri/XmlCdata.java +7 -3
- data/ext/java/nokogiri/XmlSchema.java +7 -3
- data/ext/java/nokogiri/XmlText.java +7 -3
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +5 -8
- data/ext/nokogiri/xml_cdata.c +27 -21
- data/ext/nokogiri/xml_document.c +6 -2
- data/ext/nokogiri/xml_node.c +1 -1
- data/ext/nokogiri/xml_schema.c +11 -5
- data/ext/nokogiri/xml_text.c +23 -17
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version/constant.rb +1 -1
- 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: b5a06b0a60f3964c8165d605401030d4aafbec6c83b94adaaf2e918c48a4d6e7
|
4
|
+
data.tar.gz: 4e9a23386ca131ad8814c90179a011f6129785a3eec0802401c186eb5c9fe5d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d7036c6043ca62e69408a457b5422844c6af017eb06bfe31a9f05c29b131f8875373ffdbda17ee0985c1b288a16d902f5b9719a275dfd84f0955dfbc8bce041
|
7
|
+
data.tar.gz: c0e5807524bc9e5b670cadafb6e15a2f57ae73d1d1885d39ca597b5e0667d1f4a37b42d928054408820574f3aeccf42ec133541ed1616d2f395e1030e656516a
|
data/dependencies.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
libxml2:
|
2
|
-
version: "2.11.
|
3
|
-
sha256: "
|
4
|
-
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.
|
2
|
+
version: "2.11.5"
|
3
|
+
sha256: "3727b078c360ec69fa869de14bd6f75d7ee8d36987b071e6928d4720a28df3a6"
|
4
|
+
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.5.sha256sum
|
5
5
|
|
6
6
|
libxslt:
|
7
7
|
version: "1.1.38"
|
@@ -43,15 +43,19 @@ public class XmlCdata extends XmlText
|
|
43
43
|
if (args.length < 2) {
|
44
44
|
throw getRuntime().newArgumentError(args.length, 2);
|
45
45
|
}
|
46
|
-
IRubyObject
|
46
|
+
IRubyObject rbDocument = args[0];
|
47
47
|
content = args[1];
|
48
48
|
|
49
|
-
if (!(
|
49
|
+
if (!(rbDocument instanceof XmlNode)) {
|
50
|
+
String msg = "expected first parameter to be a Nokogiri::XML::Document, received " + rbDocument.getMetaClass();
|
51
|
+
throw context.runtime.newTypeError(msg);
|
52
|
+
}
|
53
|
+
if (!(rbDocument instanceof XmlDocument)) {
|
50
54
|
// TODO: deprecate allowing Node
|
51
55
|
context.runtime.getWarnings().warn("Passing a Node as the first parameter to CDATA.new is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
|
52
56
|
}
|
53
57
|
|
54
|
-
Document document = ((XmlNode)
|
58
|
+
Document document = ((XmlNode) rbDocument).getOwnerDocument();
|
55
59
|
Node node = document.createCDATASection(rubyStringToString(content));
|
56
60
|
setNode(context.runtime, node);
|
57
61
|
}
|
@@ -143,18 +143,22 @@ public class XmlSchema extends RubyObject
|
|
143
143
|
public static IRubyObject
|
144
144
|
from_document(ThreadContext context, IRubyObject klazz, IRubyObject[] args)
|
145
145
|
{
|
146
|
-
IRubyObject
|
146
|
+
IRubyObject rbDocument = args[0];
|
147
147
|
IRubyObject parseOptions = null;
|
148
148
|
if (args.length > 1) {
|
149
149
|
parseOptions = args[1];
|
150
150
|
}
|
151
151
|
|
152
|
-
if (!(
|
152
|
+
if (!(rbDocument instanceof XmlNode)) {
|
153
|
+
String msg = "expected parameter to be a Nokogiri::XML::Document, received " + rbDocument.getMetaClass();
|
154
|
+
throw context.runtime.newTypeError(msg);
|
155
|
+
}
|
156
|
+
if (!(rbDocument instanceof XmlDocument)) {
|
153
157
|
// TODO: deprecate allowing Node
|
154
158
|
context.runtime.getWarnings().warn("Passing a Node as the first parameter to Schema.from_document is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
|
155
159
|
}
|
156
160
|
|
157
|
-
XmlDocument doc = ((XmlDocument)((XmlNode)
|
161
|
+
XmlDocument doc = ((XmlDocument)((XmlNode) rbDocument).document(context));
|
158
162
|
|
159
163
|
RubyArray<?> errors = (RubyArray) doc.getInstanceVariable("@errors");
|
160
164
|
if (!errors.isEmpty()) {
|
@@ -51,14 +51,18 @@ public class XmlText extends XmlNode
|
|
51
51
|
}
|
52
52
|
|
53
53
|
content = args[0];
|
54
|
-
IRubyObject
|
54
|
+
IRubyObject rbDocument = args[1];
|
55
55
|
|
56
|
-
if (!(
|
56
|
+
if (!(rbDocument instanceof XmlNode)) {
|
57
|
+
String msg = "expected second parameter to be a Nokogiri::XML::Document, received " + rbDocument.getMetaClass();
|
58
|
+
throw context.runtime.newTypeError(msg);
|
59
|
+
}
|
60
|
+
if (!(rbDocument instanceof XmlDocument)) {
|
57
61
|
// TODO: deprecate allowing Node
|
58
62
|
context.runtime.getWarnings().warn("Passing a Node as the second parameter to Text.new is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
|
59
63
|
}
|
60
64
|
|
61
|
-
Document document = asXmlNode(context,
|
65
|
+
Document document = asXmlNode(context, rbDocument).getOwnerDocument();
|
62
66
|
// text node content should not be encoded when it is created by Text node.
|
63
67
|
// while content should be encoded when it is created by Element node.
|
64
68
|
Node node = document.createTextNode(rubyStringToString(content));
|
@@ -808,16 +808,13 @@ public class SaveContextVisitor
|
|
808
808
|
}
|
809
809
|
|
810
810
|
private boolean
|
811
|
-
|
811
|
+
isCDATA(Text text)
|
812
812
|
{
|
813
|
-
|
813
|
+
Node parentNode = text.getParentNode();
|
814
|
+
return htmlDoc && parentNode != null && (parentNode.getNodeName().equals("style")
|
815
|
+
|| parentNode.getNodeName().equals("script"));
|
814
816
|
}
|
815
817
|
|
816
|
-
private boolean
|
817
|
-
isHtmlStyle(Text text)
|
818
|
-
{
|
819
|
-
return htmlDoc && text.getParentNode().getNodeName().equals("style");
|
820
|
-
}
|
821
818
|
|
822
819
|
public boolean
|
823
820
|
enter(Text text)
|
@@ -831,7 +828,7 @@ public class SaveContextVisitor
|
|
831
828
|
}
|
832
829
|
}
|
833
830
|
|
834
|
-
if (shouldEncode(text) && !
|
831
|
+
if (shouldEncode(text) && !isCDATA(text)) {
|
835
832
|
textContent = encodeJavaString(textContent);
|
836
833
|
}
|
837
834
|
|
data/ext/nokogiri/xml_cdata.c
CHANGED
@@ -12,39 +12,45 @@ VALUE cNokogiriXmlCData;
|
|
12
12
|
* raise a TypeError exception.
|
13
13
|
*/
|
14
14
|
static VALUE
|
15
|
-
|
15
|
+
rb_xml_cdata_s_new(int argc, VALUE *argv, VALUE klass)
|
16
16
|
{
|
17
|
-
xmlDocPtr
|
18
|
-
xmlNodePtr
|
19
|
-
VALUE
|
20
|
-
VALUE
|
21
|
-
VALUE
|
17
|
+
xmlDocPtr c_document;
|
18
|
+
xmlNodePtr c_node;
|
19
|
+
VALUE rb_document;
|
20
|
+
VALUE rb_content;
|
21
|
+
VALUE rb_rest;
|
22
22
|
VALUE rb_node;
|
23
|
-
xmlChar *
|
24
|
-
int
|
23
|
+
xmlChar *c_content = NULL;
|
24
|
+
int c_content_len = 0;
|
25
25
|
|
26
|
-
rb_scan_args(argc, argv, "2*", &
|
26
|
+
rb_scan_args(argc, argv, "2*", &rb_document, &rb_content, &rb_rest);
|
27
27
|
|
28
|
-
if (rb_obj_is_kind_of(
|
29
|
-
|
30
|
-
|
28
|
+
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlNode)) {
|
29
|
+
rb_raise(rb_eTypeError,
|
30
|
+
"expected first parameter to be a Nokogiri::XML::Document, received %"PRIsVALUE,
|
31
|
+
rb_obj_class(rb_document));
|
32
|
+
}
|
33
|
+
|
34
|
+
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
|
31
35
|
xmlNodePtr deprecated_node_type_arg;
|
32
36
|
// TODO: deprecate allowing Node
|
33
37
|
NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to CDATA.new is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
|
34
|
-
Noko_Node_Get_Struct(
|
35
|
-
|
38
|
+
Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
|
39
|
+
c_document = deprecated_node_type_arg->doc;
|
40
|
+
} else {
|
41
|
+
c_document = noko_xml_document_unwrap(rb_document);
|
36
42
|
}
|
37
43
|
|
38
|
-
if (!NIL_P(
|
39
|
-
|
40
|
-
|
44
|
+
if (!NIL_P(rb_content)) {
|
45
|
+
c_content = (xmlChar *)StringValuePtr(rb_content);
|
46
|
+
c_content_len = RSTRING_LENINT(rb_content);
|
41
47
|
}
|
42
48
|
|
43
|
-
|
49
|
+
c_node = xmlNewCDataBlock(c_document, c_content, c_content_len);
|
44
50
|
|
45
|
-
noko_xml_document_pin_node(
|
51
|
+
noko_xml_document_pin_node(c_node);
|
46
52
|
|
47
|
-
rb_node = noko_xml_node_wrap(klass,
|
53
|
+
rb_node = noko_xml_node_wrap(klass, c_node);
|
48
54
|
rb_obj_call_init(rb_node, argc, argv);
|
49
55
|
|
50
56
|
if (rb_block_given_p()) { rb_yield(rb_node); }
|
@@ -61,5 +67,5 @@ noko_init_xml_cdata(void)
|
|
61
67
|
*/
|
62
68
|
cNokogiriXmlCData = rb_define_class_under(mNokogiriXml, "CDATA", cNokogiriXmlText);
|
63
69
|
|
64
|
-
rb_define_singleton_method(cNokogiriXmlCData, "new",
|
70
|
+
rb_define_singleton_method(cNokogiriXmlCData, "new", rb_xml_cdata_s_new, -1);
|
65
71
|
}
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -100,11 +100,15 @@ memsize_node(const xmlNodePtr node)
|
|
100
100
|
{
|
101
101
|
/* note we don't count namespace definitions, just going for a good-enough number here */
|
102
102
|
xmlNodePtr child;
|
103
|
+
xmlAttrPtr property;
|
103
104
|
size_t memsize = 0;
|
104
105
|
|
105
106
|
memsize += xmlStrlen(node->name);
|
106
|
-
|
107
|
-
|
107
|
+
|
108
|
+
if (node->type == XML_ELEMENT_NODE) {
|
109
|
+
for (property = node->properties; property; property = property->next) {
|
110
|
+
memsize += sizeof(xmlAttr) + memsize_node((xmlNodePtr)property);
|
111
|
+
}
|
108
112
|
}
|
109
113
|
if (node->type == XML_TEXT_NODE) {
|
110
114
|
memsize += xmlStrlen(node->content);
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -350,7 +350,7 @@ ok:
|
|
350
350
|
|
351
351
|
xmlUnlinkNode(original_reparentee);
|
352
352
|
|
353
|
-
if (prf != xmlAddPrevSibling && prf != xmlAddNextSibling
|
353
|
+
if (prf != xmlAddPrevSibling && prf != xmlAddNextSibling && prf != xmlAddChild
|
354
354
|
&& reparentee->type == XML_TEXT_NODE && pivot->next && pivot->next->type == XML_TEXT_NODE) {
|
355
355
|
/*
|
356
356
|
* libxml merges text nodes in a right-to-left fashion, meaning that if
|
data/ext/nokogiri/xml_schema.c
CHANGED
@@ -203,7 +203,7 @@ read_memory(int argc, VALUE *argv, VALUE klass)
|
|
203
203
|
* [Returns] Nokogiri::XML::Schema
|
204
204
|
*/
|
205
205
|
static VALUE
|
206
|
-
|
206
|
+
rb_xml_schema_s_from_document(int argc, VALUE *argv, VALUE klass)
|
207
207
|
{
|
208
208
|
VALUE rb_document;
|
209
209
|
VALUE rb_parse_options;
|
@@ -214,14 +214,20 @@ from_document(int argc, VALUE *argv, VALUE klass)
|
|
214
214
|
|
215
215
|
rb_scan_args(argc, argv, "11", &rb_document, &rb_parse_options);
|
216
216
|
|
217
|
-
if (rb_obj_is_kind_of(rb_document,
|
218
|
-
|
219
|
-
|
217
|
+
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlNode)) {
|
218
|
+
rb_raise(rb_eTypeError,
|
219
|
+
"expected parameter to be a Nokogiri::XML::Document, received %"PRIsVALUE,
|
220
|
+
rb_obj_class(rb_document));
|
221
|
+
}
|
222
|
+
|
223
|
+
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
|
220
224
|
xmlNodePtr deprecated_node_type_arg;
|
221
225
|
// TODO: deprecate allowing Node
|
222
226
|
NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to Schema.from_document is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
|
223
227
|
Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
|
224
228
|
c_document = deprecated_node_type_arg->doc;
|
229
|
+
} else {
|
230
|
+
c_document = noko_xml_document_unwrap(rb_document);
|
225
231
|
}
|
226
232
|
|
227
233
|
if (noko_xml_document_has_wrapped_blank_nodes_p(c_document)) {
|
@@ -249,7 +255,7 @@ noko_init_xml_schema(void)
|
|
249
255
|
rb_undef_alloc_func(cNokogiriXmlSchema);
|
250
256
|
|
251
257
|
rb_define_singleton_method(cNokogiriXmlSchema, "read_memory", read_memory, -1);
|
252
|
-
rb_define_singleton_method(cNokogiriXmlSchema, "from_document",
|
258
|
+
rb_define_singleton_method(cNokogiriXmlSchema, "from_document", rb_xml_schema_s_from_document, -1);
|
253
259
|
|
254
260
|
rb_define_private_method(cNokogiriXmlSchema, "validate_document", validate_document, 1);
|
255
261
|
rb_define_private_method(cNokogiriXmlSchema, "validate_file", validate_file, 1);
|
data/ext/nokogiri/xml_text.c
CHANGED
@@ -9,33 +9,39 @@ VALUE cNokogiriXmlText ;
|
|
9
9
|
* Create a new Text element on the +document+ with +content+
|
10
10
|
*/
|
11
11
|
static VALUE
|
12
|
-
|
12
|
+
rb_xml_text_s_new(int argc, VALUE *argv, VALUE klass)
|
13
13
|
{
|
14
|
-
xmlDocPtr
|
15
|
-
xmlNodePtr
|
16
|
-
VALUE
|
17
|
-
VALUE
|
18
|
-
VALUE
|
14
|
+
xmlDocPtr c_document;
|
15
|
+
xmlNodePtr c_node;
|
16
|
+
VALUE rb_string;
|
17
|
+
VALUE rb_document;
|
18
|
+
VALUE rb_rest;
|
19
19
|
VALUE rb_node;
|
20
20
|
|
21
|
-
rb_scan_args(argc, argv, "2*", &
|
21
|
+
rb_scan_args(argc, argv, "2*", &rb_string, &rb_document, &rb_rest);
|
22
22
|
|
23
|
-
if (rb_obj_is_kind_of(
|
24
|
-
|
25
|
-
|
23
|
+
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlNode)) {
|
24
|
+
rb_raise(rb_eTypeError,
|
25
|
+
"expected second parameter to be a Nokogiri::XML::Document, received %"PRIsVALUE,
|
26
|
+
rb_obj_class(rb_document));
|
27
|
+
}
|
28
|
+
|
29
|
+
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
|
26
30
|
xmlNodePtr deprecated_node_type_arg;
|
27
31
|
// TODO: deprecate allowing Node
|
28
32
|
NOKO_WARN_DEPRECATION("Passing a Node as the second parameter to Text.new is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
|
29
|
-
Noko_Node_Get_Struct(
|
30
|
-
|
33
|
+
Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
|
34
|
+
c_document = deprecated_node_type_arg->doc;
|
35
|
+
} else {
|
36
|
+
c_document = noko_xml_document_unwrap(rb_document);
|
31
37
|
}
|
32
38
|
|
33
|
-
|
34
|
-
|
39
|
+
c_node = xmlNewText((xmlChar *)StringValueCStr(rb_string));
|
40
|
+
c_node->doc = c_document;
|
35
41
|
|
36
|
-
noko_xml_document_pin_node(
|
42
|
+
noko_xml_document_pin_node(c_node);
|
37
43
|
|
38
|
-
rb_node = noko_xml_node_wrap(klass,
|
44
|
+
rb_node = noko_xml_node_wrap(klass, c_node) ;
|
39
45
|
rb_obj_call_init(rb_node, argc, argv);
|
40
46
|
|
41
47
|
if (rb_block_given_p()) { rb_yield(rb_node); }
|
@@ -52,5 +58,5 @@ noko_init_xml_text(void)
|
|
52
58
|
*/
|
53
59
|
cNokogiriXmlText = rb_define_class_under(mNokogiriXml, "Text", cNokogiriXmlCharacterData);
|
54
60
|
|
55
|
-
rb_define_singleton_method(cNokogiriXmlText, "new",
|
61
|
+
rb_define_singleton_method(cNokogiriXmlText, "new", rb_xml_text_s_new, -1);
|
56
62
|
}
|
data/lib/nokogiri/nokogiri.jar
CHANGED
Binary file
|
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.15.
|
4
|
+
version: 1.15.4
|
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: 2023-
|
23
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
requirement: !ruby/object:Gem::Requirement
|