nokogiri 1.13.4-x86_64-linux → 1.13.7-x86_64-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b37dfce31396ecd4f20b5bbb825c896c2828a131e66eb3be3936bf18631d00c2
4
- data.tar.gz: 85cd80de0843e22e48d4922cff590fa0919eab13af938758cc07d1f1fb390115
3
+ metadata.gz: 8fd2542bf909d7b435902e8b6fc455cbf0b16f5c5b385f1b4ddab6d15a785d9a
4
+ data.tar.gz: 01b33d5f8245e6a35a9900076835a00130606a934c156616f49bf0078f0d9d1d
5
5
  SHA512:
6
- metadata.gz: b182b67287d8f9e637f19bd40d24f1bb168d38fa638ca4aa59f9afe28858cbaf571c4cbf4df1f02a19269ecbec29ad168b504020c0eae982fd16c607d8b552bf
7
- data.tar.gz: 6a13d14772e6222d457da7047be2cd2c611bda75c2162643044979a7512ce688c1c7eda52126c88b73512469f18ad641827b611cb74025182fab98d12128a9dd
6
+ metadata.gz: 96c3f6052d74d98dd5427ff05cdb80ce761626d8abdd0e016f5606f20694bf11d96fb973b60d13ebbec489603f3a38b4c6a7a3feee20c7a2cc44e5d03b301c1b
7
+ data.tar.gz: 5411a74e28224f53677206828c363a149672cff48244e5b2d3ce3cd013ae41a038bd67cb7a206ad8058bc6026c85e71545da9ea0d7d4b152d74382e6ed6b6fc6
data/dependencies.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  libxml2:
2
- version: "2.9.13"
3
- sha256: "276130602d12fe484ecc03447ee5e759d0465558fbc9d6bd144e3745306ebf0e"
4
- # sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.sha256sum
2
+ version: "2.9.14"
3
+ sha256: "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee"
4
+ # sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.sha256sum
5
5
 
6
6
  libxslt:
7
7
  version: "1.1.35"
@@ -973,6 +973,7 @@ have_func("xmlRelaxNGSetParserStructuredErrors") # introduced in libxml 2.6.24
973
973
  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
+ have_func("rb_gc_location") # introduced in Ruby 2.7
976
977
 
977
978
  have_func("vasprintf")
978
979
 
data/ext/nokogiri/gumbo.c CHANGED
@@ -401,7 +401,7 @@ static xmlNodePtr
401
401
  extract_xml_node(VALUE node)
402
402
  {
403
403
  xmlNodePtr xml_node;
404
- Data_Get_Struct(node, xmlNode, xml_node);
404
+ Noko_Node_Get_Struct(node, xmlNode, xml_node);
405
405
  return xml_node;
406
406
  }
407
407
 
@@ -19,9 +19,8 @@ parse_memory(VALUE klass, VALUE data, VALUE encoding)
19
19
  {
20
20
  htmlParserCtxtPtr ctxt;
21
21
 
22
- if (NIL_P(data)) {
23
- rb_raise(rb_eArgError, "data cannot be nil");
24
- }
22
+ Check_Type(data, T_STRING);
23
+
25
24
  if (!(int)RSTRING_LEN(data)) {
26
25
  rb_raise(rb_eRuntimeError, "data cannot be empty");
27
26
  }
@@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
29
29
  *
30
30
  * the version string like "1.2.3"
31
31
  */
32
- #define LIBXML_DOTTED_VERSION "2.9.13"
32
+ #define LIBXML_DOTTED_VERSION "2.9.14"
33
33
 
34
34
  /**
35
35
  * LIBXML_VERSION:
36
36
  *
37
37
  * the version number: 1.2.3 value is 10203
38
38
  */
39
- #define LIBXML_VERSION 20913
39
+ #define LIBXML_VERSION 20914
40
40
 
41
41
  /**
42
42
  * LIBXML_VERSION_STRING:
43
43
  *
44
44
  * the version number string, 1.2.3 value is "10203"
45
45
  */
46
- #define LIBXML_VERSION_STRING "20913"
46
+ #define LIBXML_VERSION_STRING "20914"
47
47
 
48
48
  /**
49
49
  * LIBXML_VERSION_EXTRA:
@@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
58
58
  * Macro to check that the libxml version in use is compatible with
59
59
  * the version the software has been compiled against
60
60
  */
61
- #define LIBXML_TEST_VERSION xmlCheckVersion(20913);
61
+ #define LIBXML_TEST_VERSION xmlCheckVersion(20914);
62
62
 
63
63
  #ifndef VMS
64
64
  #if 0
@@ -170,6 +170,8 @@ int noko_io_read(void *ctx, char *buffer, int len);
170
170
  int noko_io_write(void *ctx, char *buffer, int len);
171
171
  int noko_io_close(void *ctx);
172
172
 
173
+ #define Noko_Node_Get_Struct(obj,type,sval) ((sval) = (type*)DATA_PTR(obj))
174
+
173
175
  VALUE noko_xml_node_wrap(VALUE klass, xmlNodePtr node) ;
174
176
  VALUE noko_xml_node_wrap_node_set_result(xmlNodePtr node, VALUE node_set) ;
175
177
  VALUE noko_xml_node_attrs(xmlNodePtr node) ;
@@ -16,7 +16,7 @@ set_value(VALUE self, VALUE content)
16
16
  xmlChar *value;
17
17
  xmlNode *cur;
18
18
 
19
- Data_Get_Struct(self, xmlAttr, attr);
19
+ Noko_Node_Get_Struct(self, xmlAttr, attr);
20
20
 
21
21
  if (attr->children) {
22
22
  xmlFreeNodeList(attr->children);
@@ -68,7 +68,7 @@ new (int argc, VALUE *argv, VALUE klass)
68
68
  rb_raise(rb_eArgError, "parameter must be a Nokogiri::XML::Document");
69
69
  }
70
70
 
71
- Data_Get_Struct(document, xmlDoc, xml_doc);
71
+ Noko_Node_Get_Struct(document, xmlDoc, xml_doc);
72
72
 
73
73
  node = xmlNewDocProp(
74
74
  xml_doc,
@@ -12,7 +12,7 @@ static VALUE
12
12
  attribute_type(VALUE self)
13
13
  {
14
14
  xmlAttributePtr node;
15
- Data_Get_Struct(self, xmlAttribute, node);
15
+ Noko_Node_Get_Struct(self, xmlAttribute, node);
16
16
  return INT2NUM((long)node->atype);
17
17
  }
18
18
 
@@ -26,7 +26,7 @@ static VALUE
26
26
  default_value(VALUE self)
27
27
  {
28
28
  xmlAttributePtr node;
29
- Data_Get_Struct(self, xmlAttribute, node);
29
+ Noko_Node_Get_Struct(self, xmlAttribute, node);
30
30
 
31
31
  if (node->defaultValue) { return NOKOGIRI_STR_NEW2(node->defaultValue); }
32
32
  return Qnil;
@@ -45,7 +45,7 @@ enumeration(VALUE self)
45
45
  xmlEnumerationPtr enm;
46
46
  VALUE list;
47
47
 
48
- Data_Get_Struct(self, xmlAttribute, node);
48
+ Noko_Node_Get_Struct(self, xmlAttribute, node);
49
49
 
50
50
  list = rb_ary_new();
51
51
  enm = node->tree;
@@ -25,7 +25,7 @@ new (int argc, VALUE *argv, VALUE klass)
25
25
 
26
26
  rb_scan_args(argc, argv, "2*", &doc, &content, &rest);
27
27
 
28
- Data_Get_Struct(doc, xmlDoc, xml_doc);
28
+ Noko_Node_Get_Struct(doc, xmlDoc, xml_doc);
29
29
 
30
30
  if (!NIL_P(content)) {
31
31
  content_str = (xmlChar *)StringValuePtr(content);
@@ -161,7 +161,7 @@ rb_xml_document_root_set(VALUE self, VALUE rb_new_root)
161
161
  rb_obj_class(rb_new_root));
162
162
  }
163
163
 
164
- Data_Get_Struct(rb_new_root, xmlNode, c_new_root);
164
+ Noko_Node_Get_Struct(rb_new_root, xmlNode, c_new_root);
165
165
 
166
166
  /* If the new root's document is not the same as the current document,
167
167
  * then we need to dup the node in to this document. */
@@ -44,7 +44,7 @@ entities(VALUE self)
44
44
  xmlDtdPtr dtd;
45
45
  VALUE hash;
46
46
 
47
- Data_Get_Struct(self, xmlDtd, dtd);
47
+ Noko_Node_Get_Struct(self, xmlDtd, dtd);
48
48
 
49
49
  if (!dtd->entities) { return Qnil; }
50
50
 
@@ -67,7 +67,7 @@ notations(VALUE self)
67
67
  xmlDtdPtr dtd;
68
68
  VALUE hash;
69
69
 
70
- Data_Get_Struct(self, xmlDtd, dtd);
70
+ Noko_Node_Get_Struct(self, xmlDtd, dtd);
71
71
 
72
72
  if (!dtd->notations) { return Qnil; }
73
73
 
@@ -90,7 +90,7 @@ attributes(VALUE self)
90
90
  xmlDtdPtr dtd;
91
91
  VALUE hash;
92
92
 
93
- Data_Get_Struct(self, xmlDtd, dtd);
93
+ Noko_Node_Get_Struct(self, xmlDtd, dtd);
94
94
 
95
95
  hash = rb_hash_new();
96
96
 
@@ -113,7 +113,7 @@ elements(VALUE self)
113
113
  xmlDtdPtr dtd;
114
114
  VALUE hash;
115
115
 
116
- Data_Get_Struct(self, xmlDtd, dtd);
116
+ Noko_Node_Get_Struct(self, xmlDtd, dtd);
117
117
 
118
118
  if (!dtd->elements) { return Qnil; }
119
119
 
@@ -138,8 +138,8 @@ validate(VALUE self, VALUE document)
138
138
  xmlValidCtxtPtr ctxt;
139
139
  VALUE error_list;
140
140
 
141
- Data_Get_Struct(self, xmlDtd, dtd);
142
- Data_Get_Struct(document, xmlDoc, doc);
141
+ Noko_Node_Get_Struct(self, xmlDtd, dtd);
142
+ Noko_Node_Get_Struct(document, xmlDoc, doc);
143
143
  error_list = rb_ary_new();
144
144
 
145
145
  ctxt = xmlNewValidCtxt();
@@ -165,7 +165,7 @@ static VALUE
165
165
  system_id(VALUE self)
166
166
  {
167
167
  xmlDtdPtr dtd;
168
- Data_Get_Struct(self, xmlDtd, dtd);
168
+ Noko_Node_Get_Struct(self, xmlDtd, dtd);
169
169
 
170
170
  if (!dtd->SystemID) { return Qnil; }
171
171
 
@@ -182,7 +182,7 @@ static VALUE
182
182
  external_id(VALUE self)
183
183
  {
184
184
  xmlDtdPtr dtd;
185
- Data_Get_Struct(self, xmlDtd, dtd);
185
+ Noko_Node_Get_Struct(self, xmlDtd, dtd);
186
186
 
187
187
  if (!dtd->ExternalID) { return Qnil; }
188
188
 
@@ -14,7 +14,7 @@ static VALUE
14
14
  element_type(VALUE self)
15
15
  {
16
16
  xmlElementPtr node;
17
- Data_Get_Struct(self, xmlElement, node);
17
+ Noko_Node_Get_Struct(self, xmlElement, node);
18
18
  return INT2NUM((long)node->etype);
19
19
  }
20
20
 
@@ -28,7 +28,7 @@ static VALUE
28
28
  content(VALUE self)
29
29
  {
30
30
  xmlElementPtr node;
31
- Data_Get_Struct(self, xmlElement, node);
31
+ Noko_Node_Get_Struct(self, xmlElement, node);
32
32
 
33
33
  if (!node->content) { return Qnil; }
34
34
 
@@ -48,7 +48,7 @@ static VALUE
48
48
  prefix(VALUE self)
49
49
  {
50
50
  xmlElementPtr node;
51
- Data_Get_Struct(self, xmlElement, node);
51
+ Noko_Node_Get_Struct(self, xmlElement, node);
52
52
 
53
53
  if (!node->prefix) { return Qnil; }
54
54
 
@@ -12,7 +12,7 @@ static VALUE
12
12
  original_content(VALUE self)
13
13
  {
14
14
  xmlEntityPtr node;
15
- Data_Get_Struct(self, xmlEntity, node);
15
+ Noko_Node_Get_Struct(self, xmlEntity, node);
16
16
 
17
17
  if (!node->orig) { return Qnil; }
18
18
 
@@ -29,7 +29,7 @@ static VALUE
29
29
  get_content(VALUE self)
30
30
  {
31
31
  xmlEntityPtr node;
32
- Data_Get_Struct(self, xmlEntity, node);
32
+ Noko_Node_Get_Struct(self, xmlEntity, node);
33
33
 
34
34
  if (!node->content) { return Qnil; }
35
35
 
@@ -46,7 +46,7 @@ static VALUE
46
46
  entity_type(VALUE self)
47
47
  {
48
48
  xmlEntityPtr node;
49
- Data_Get_Struct(self, xmlEntity, node);
49
+ Noko_Node_Get_Struct(self, xmlEntity, node);
50
50
 
51
51
  return INT2NUM((int)node->etype);
52
52
  }
@@ -61,7 +61,7 @@ static VALUE
61
61
  external_id(VALUE self)
62
62
  {
63
63
  xmlEntityPtr node;
64
- Data_Get_Struct(self, xmlEntity, node);
64
+ Noko_Node_Get_Struct(self, xmlEntity, node);
65
65
 
66
66
  if (!node->ExternalID) { return Qnil; }
67
67
 
@@ -78,7 +78,7 @@ static VALUE
78
78
  system_id(VALUE self)
79
79
  {
80
80
  xmlEntityPtr node;
81
- Data_Get_Struct(self, xmlEntity, node);
81
+ Noko_Node_Get_Struct(self, xmlEntity, node);
82
82
 
83
83
  if (!node->SystemID) { return Qnil; }
84
84
 
@@ -7,7 +7,6 @@ static ID id_decorate, id_decorate_bang;
7
7
 
8
8
  typedef xmlNodePtr(*pivot_reparentee_func)(xmlNodePtr, xmlNodePtr);
9
9
 
10
-
11
10
  #ifdef DEBUG
12
11
  static void
13
12
  _xml_node_dealloc(xmlNodePtr x)
@@ -19,10 +18,13 @@ _xml_node_dealloc(xmlNodePtr x)
19
18
  # define _xml_node_dealloc 0
20
19
  #endif
21
20
 
22
-
23
21
  static void
24
22
  _xml_node_mark(xmlNodePtr node)
25
23
  {
24
+ if (!DOC_RUBY_OBJECT_TEST(node->doc)) {
25
+ return;
26
+ }
27
+
26
28
  xmlDocPtr doc = node->doc;
27
29
  if (doc->type == XML_DOCUMENT_NODE || doc->type == XML_HTML_DOCUMENT_NODE) {
28
30
  if (DOC_RUBY_OBJECT_TEST(doc)) {
@@ -33,6 +35,31 @@ _xml_node_mark(xmlNodePtr node)
33
35
  }
34
36
  }
35
37
 
38
+ #ifdef HAVE_RB_GC_LOCATION
39
+ static void
40
+ _xml_node_update_references(xmlNodePtr node)
41
+ {
42
+ if (node->_private) {
43
+ node->_private = (void *)rb_gc_location((VALUE)node->_private);
44
+ }
45
+ }
46
+ #endif
47
+
48
+ typedef void (*gc_callback_t)(void *);
49
+
50
+ static const rb_data_type_t nokogiri_node_type = {
51
+ "Nokogiri/XMLNode",
52
+ {
53
+ (gc_callback_t)_xml_node_mark, (gc_callback_t)_xml_node_dealloc, 0,
54
+ #ifdef HAVE_RB_GC_LOCATION
55
+ (gc_callback_t)_xml_node_update_references
56
+ #endif
57
+ },
58
+ 0, 0,
59
+ #ifdef RUBY_TYPED_FREE_IMMEDIATELY
60
+ RUBY_TYPED_FREE_IMMEDIATELY,
61
+ #endif
62
+ };
36
63
 
37
64
  static void
38
65
  relink_namespace(xmlNodePtr reparented)
@@ -198,8 +225,8 @@ reparent_node_with(VALUE pivot_obj, VALUE reparentee_obj, pivot_reparentee_func
198
225
  rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node");
199
226
  }
200
227
 
201
- Data_Get_Struct(reparentee_obj, xmlNode, reparentee);
202
- Data_Get_Struct(pivot_obj, xmlNode, pivot);
228
+ Noko_Node_Get_Struct(reparentee_obj, xmlNode, reparentee);
229
+ Noko_Node_Get_Struct(pivot_obj, xmlNode, pivot);
203
230
 
204
231
  /*
205
232
  * Check if nodes given are appropriate to have a parent-child
@@ -439,7 +466,7 @@ rb_xml_node_add_namespace_definition(VALUE rb_node, VALUE rb_prefix, VALUE rb_hr
439
466
  xmlNsPtr c_namespace;
440
467
  const xmlChar *c_prefix = (const xmlChar *)(NIL_P(rb_prefix) ? NULL : StringValueCStr(rb_prefix));
441
468
 
442
- Data_Get_Struct(rb_node, xmlNode, c_node);
469
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
443
470
  element = c_node ;
444
471
 
445
472
  c_namespace = xmlSearchNs(c_node->doc, c_node, c_prefix);
@@ -506,7 +533,7 @@ rb_xml_node_attribute(VALUE self, VALUE name)
506
533
  {
507
534
  xmlNodePtr node;
508
535
  xmlAttrPtr prop;
509
- Data_Get_Struct(self, xmlNode, node);
536
+ Noko_Node_Get_Struct(self, xmlNode, node);
510
537
  prop = xmlHasProp(node, (xmlChar *)StringValueCStr(name));
511
538
 
512
539
  if (! prop) { return Qnil; }
@@ -557,7 +584,7 @@ rb_xml_node_attribute_nodes(VALUE rb_node)
557
584
  {
558
585
  xmlNodePtr c_node;
559
586
 
560
- Data_Get_Struct(rb_node, xmlNode, c_node);
587
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
561
588
 
562
589
  return noko_xml_node_attrs(c_node);
563
590
  }
@@ -609,7 +636,7 @@ rb_xml_node_attribute_with_ns(VALUE self, VALUE name, VALUE namespace)
609
636
  {
610
637
  xmlNodePtr node;
611
638
  xmlAttrPtr prop;
612
- Data_Get_Struct(self, xmlNode, node);
639
+ Noko_Node_Get_Struct(self, xmlNode, node);
613
640
  prop = xmlHasNsProp(node, (xmlChar *)StringValueCStr(name),
614
641
  NIL_P(namespace) ? NULL : (xmlChar *)StringValueCStr(namespace));
615
642
 
@@ -636,7 +663,7 @@ static VALUE
636
663
  rb_xml_node_blank_eh(VALUE self)
637
664
  {
638
665
  xmlNodePtr node;
639
- Data_Get_Struct(self, xmlNode, node);
666
+ Noko_Node_Get_Struct(self, xmlNode, node);
640
667
  return (1 == xmlIsBlankNode(node)) ? Qtrue : Qfalse ;
641
668
  }
642
669
 
@@ -658,7 +685,7 @@ static VALUE
658
685
  rb_xml_node_child(VALUE self)
659
686
  {
660
687
  xmlNodePtr node, child;
661
- Data_Get_Struct(self, xmlNode, node);
688
+ Noko_Node_Get_Struct(self, xmlNode, node);
662
689
 
663
690
  child = node->children;
664
691
  if (!child) { return Qnil; }
@@ -683,7 +710,7 @@ rb_xml_node_children(VALUE self)
683
710
  VALUE document;
684
711
  VALUE node_set;
685
712
 
686
- Data_Get_Struct(self, xmlNode, node);
713
+ Noko_Node_Get_Struct(self, xmlNode, node);
687
714
 
688
715
  child = node->children;
689
716
  set = xmlXPathNodeSetCreate(child);
@@ -742,7 +769,7 @@ rb_xml_node_content(VALUE self)
742
769
  xmlNodePtr node;
743
770
  xmlChar *content;
744
771
 
745
- Data_Get_Struct(self, xmlNode, node);
772
+ Noko_Node_Get_Struct(self, xmlNode, node);
746
773
 
747
774
  content = xmlNodeGetContent(node);
748
775
  if (content) {
@@ -765,7 +792,7 @@ static VALUE
765
792
  rb_xml_node_document(VALUE self)
766
793
  {
767
794
  xmlNodePtr node;
768
- Data_Get_Struct(self, xmlNode, node);
795
+ Noko_Node_Get_Struct(self, xmlNode, node);
769
796
  return DOC_RUBY_OBJECT(node->doc);
770
797
  }
771
798
 
@@ -780,7 +807,7 @@ static VALUE
780
807
  rb_xml_node_pointer_id(VALUE self)
781
808
  {
782
809
  xmlNodePtr node;
783
- Data_Get_Struct(self, xmlNode, node);
810
+ Noko_Node_Get_Struct(self, xmlNode, node);
784
811
 
785
812
  return INT2NUM((long)(node));
786
813
  }
@@ -797,7 +824,7 @@ encode_special_chars(VALUE self, VALUE string)
797
824
  xmlChar *encoded;
798
825
  VALUE encoded_str;
799
826
 
800
- Data_Get_Struct(self, xmlNode, node);
827
+ Noko_Node_Get_Struct(self, xmlNode, node);
801
828
  encoded = xmlEncodeSpecialChars(
802
829
  node->doc,
803
830
  (const xmlChar *)StringValueCStr(string)
@@ -828,7 +855,7 @@ create_internal_subset(VALUE self, VALUE name, VALUE external_id, VALUE system_i
828
855
  xmlDocPtr doc;
829
856
  xmlDtdPtr dtd;
830
857
 
831
- Data_Get_Struct(self, xmlNode, node);
858
+ Noko_Node_Get_Struct(self, xmlNode, node);
832
859
 
833
860
  doc = node->doc;
834
861
 
@@ -861,7 +888,7 @@ create_external_subset(VALUE self, VALUE name, VALUE external_id, VALUE system_i
861
888
  xmlDocPtr doc;
862
889
  xmlDtdPtr dtd;
863
890
 
864
- Data_Get_Struct(self, xmlNode, node);
891
+ Noko_Node_Get_Struct(self, xmlNode, node);
865
892
 
866
893
  doc = node->doc;
867
894
 
@@ -894,7 +921,7 @@ external_subset(VALUE self)
894
921
  xmlDocPtr doc;
895
922
  xmlDtdPtr dtd;
896
923
 
897
- Data_Get_Struct(self, xmlNode, node);
924
+ Noko_Node_Get_Struct(self, xmlNode, node);
898
925
 
899
926
  if (!node->doc) { return Qnil; }
900
927
 
@@ -919,7 +946,7 @@ internal_subset(VALUE self)
919
946
  xmlDocPtr doc;
920
947
  xmlDtdPtr dtd;
921
948
 
922
- Data_Get_Struct(self, xmlNode, node);
949
+ Noko_Node_Get_Struct(self, xmlNode, node);
923
950
 
924
951
  if (!node->doc) { return Qnil; }
925
952
 
@@ -955,7 +982,7 @@ duplicate_node(int argc, VALUE *argv, VALUE self)
955
982
  xmlDocPtr new_parent_doc;
956
983
  xmlNodePtr node, dup;
957
984
 
958
- Data_Get_Struct(self, xmlNode, node);
985
+ Noko_Node_Get_Struct(self, xmlNode, node);
959
986
 
960
987
  n_args = rb_scan_args(argc, argv, "02", &r_level, &r_new_parent_doc);
961
988
 
@@ -988,7 +1015,7 @@ static VALUE
988
1015
  unlink_node(VALUE self)
989
1016
  {
990
1017
  xmlNodePtr node;
991
- Data_Get_Struct(self, xmlNode, node);
1018
+ Noko_Node_Get_Struct(self, xmlNode, node);
992
1019
  xmlUnlinkNode(node);
993
1020
  noko_xml_document_pin_node(node);
994
1021
  return self;
@@ -1005,7 +1032,7 @@ static VALUE
1005
1032
  next_sibling(VALUE self)
1006
1033
  {
1007
1034
  xmlNodePtr node, sibling;
1008
- Data_Get_Struct(self, xmlNode, node);
1035
+ Noko_Node_Get_Struct(self, xmlNode, node);
1009
1036
 
1010
1037
  sibling = node->next;
1011
1038
  if (!sibling) { return Qnil; }
@@ -1023,7 +1050,7 @@ static VALUE
1023
1050
  previous_sibling(VALUE self)
1024
1051
  {
1025
1052
  xmlNodePtr node, sibling;
1026
- Data_Get_Struct(self, xmlNode, node);
1053
+ Noko_Node_Get_Struct(self, xmlNode, node);
1027
1054
 
1028
1055
  sibling = node->prev;
1029
1056
  if (!sibling) { return Qnil; }
@@ -1041,7 +1068,7 @@ static VALUE
1041
1068
  next_element(VALUE self)
1042
1069
  {
1043
1070
  xmlNodePtr node, sibling;
1044
- Data_Get_Struct(self, xmlNode, node);
1071
+ Noko_Node_Get_Struct(self, xmlNode, node);
1045
1072
 
1046
1073
  sibling = xmlNextElementSibling(node);
1047
1074
  if (!sibling) { return Qnil; }
@@ -1059,7 +1086,7 @@ static VALUE
1059
1086
  previous_element(VALUE self)
1060
1087
  {
1061
1088
  xmlNodePtr node, sibling;
1062
- Data_Get_Struct(self, xmlNode, node);
1089
+ Noko_Node_Get_Struct(self, xmlNode, node);
1063
1090
 
1064
1091
  /*
1065
1092
  * note that we don't use xmlPreviousElementSibling here because it's buggy pre-2.7.7.
@@ -1081,7 +1108,7 @@ replace(VALUE self, VALUE new_node)
1081
1108
  VALUE reparent = reparent_node_with(self, new_node, xmlReplaceNodeWrapper);
1082
1109
 
1083
1110
  xmlNodePtr pivot;
1084
- Data_Get_Struct(self, xmlNode, pivot);
1111
+ Noko_Node_Get_Struct(self, xmlNode, pivot);
1085
1112
  noko_xml_document_pin_node(pivot);
1086
1113
 
1087
1114
  return reparent;
@@ -1116,7 +1143,7 @@ rb_xml_node_element_children(VALUE self)
1116
1143
  VALUE document;
1117
1144
  VALUE node_set;
1118
1145
 
1119
- Data_Get_Struct(self, xmlNode, node);
1146
+ Noko_Node_Get_Struct(self, xmlNode, node);
1120
1147
 
1121
1148
  child = xmlFirstElementChild(node);
1122
1149
  set = xmlXPathNodeSetCreate(child);
@@ -1155,7 +1182,7 @@ static VALUE
1155
1182
  rb_xml_node_first_element_child(VALUE self)
1156
1183
  {
1157
1184
  xmlNodePtr node, child;
1158
- Data_Get_Struct(self, xmlNode, node);
1185
+ Noko_Node_Get_Struct(self, xmlNode, node);
1159
1186
 
1160
1187
  child = xmlFirstElementChild(node);
1161
1188
  if (!child) { return Qnil; }
@@ -1182,7 +1209,7 @@ static VALUE
1182
1209
  rb_xml_node_last_element_child(VALUE self)
1183
1210
  {
1184
1211
  xmlNodePtr node, child;
1185
- Data_Get_Struct(self, xmlNode, node);
1212
+ Noko_Node_Get_Struct(self, xmlNode, node);
1186
1213
 
1187
1214
  child = xmlLastElementChild(node);
1188
1215
  if (!child) { return Qnil; }
@@ -1200,7 +1227,7 @@ static VALUE
1200
1227
  key_eh(VALUE self, VALUE attribute)
1201
1228
  {
1202
1229
  xmlNodePtr node;
1203
- Data_Get_Struct(self, xmlNode, node);
1230
+ Noko_Node_Get_Struct(self, xmlNode, node);
1204
1231
  if (xmlHasProp(node, (xmlChar *)StringValueCStr(attribute))) {
1205
1232
  return Qtrue;
1206
1233
  }
@@ -1217,7 +1244,7 @@ static VALUE
1217
1244
  namespaced_key_eh(VALUE self, VALUE attribute, VALUE namespace)
1218
1245
  {
1219
1246
  xmlNodePtr node;
1220
- Data_Get_Struct(self, xmlNode, node);
1247
+ Noko_Node_Get_Struct(self, xmlNode, node);
1221
1248
  if (xmlHasNsProp(node, (xmlChar *)StringValueCStr(attribute),
1222
1249
  NIL_P(namespace) ? NULL : (xmlChar *)StringValueCStr(namespace))) {
1223
1250
  return Qtrue;
@@ -1236,7 +1263,7 @@ set(VALUE self, VALUE property, VALUE value)
1236
1263
  {
1237
1264
  xmlNodePtr node, cur;
1238
1265
  xmlAttrPtr prop;
1239
- Data_Get_Struct(self, xmlNode, node);
1266
+ Noko_Node_Get_Struct(self, xmlNode, node);
1240
1267
 
1241
1268
  /* If a matching attribute node already exists, then xmlSetProp will destroy
1242
1269
  * the existing node's children. However, if Nokogiri has a node object
@@ -1281,7 +1308,7 @@ get(VALUE self, VALUE rattribute)
1281
1308
 
1282
1309
  if (NIL_P(rattribute)) { return Qnil; }
1283
1310
 
1284
- Data_Get_Struct(self, xmlNode, node);
1311
+ Noko_Node_Get_Struct(self, xmlNode, node);
1285
1312
  attribute = xmlCharStrdup(StringValueCStr(rattribute));
1286
1313
 
1287
1314
  colon = DISCARD_CONST_QUAL_XMLCHAR(xmlStrchr(attribute, (const xmlChar)':'));
@@ -1323,7 +1350,7 @@ set_namespace(VALUE self, VALUE namespace)
1323
1350
  xmlNodePtr node;
1324
1351
  xmlNsPtr ns = NULL;
1325
1352
 
1326
- Data_Get_Struct(self, xmlNode, node);
1353
+ Noko_Node_Get_Struct(self, xmlNode, node);
1327
1354
 
1328
1355
  if (!NIL_P(namespace)) {
1329
1356
  Data_Get_Struct(namespace, xmlNs, ns);
@@ -1360,7 +1387,7 @@ static VALUE
1360
1387
  rb_xml_node_namespace(VALUE rb_node)
1361
1388
  {
1362
1389
  xmlNodePtr c_node ;
1363
- Data_Get_Struct(rb_node, xmlNode, c_node);
1390
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
1364
1391
 
1365
1392
  if (c_node->ns) {
1366
1393
  return noko_xml_namespace_wrap(c_node->ns, c_node->doc);
@@ -1405,7 +1432,7 @@ namespace_definitions(VALUE rb_node)
1405
1432
  xmlNsPtr c_namespace;
1406
1433
  VALUE definitions = rb_ary_new();
1407
1434
 
1408
- Data_Get_Struct(rb_node, xmlNode, c_node);
1435
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
1409
1436
 
1410
1437
  c_namespace = c_node->nsDef;
1411
1438
  if (!c_namespace) {
@@ -1456,7 +1483,7 @@ rb_xml_node_namespace_scopes(VALUE rb_node)
1456
1483
  VALUE scopes = rb_ary_new();
1457
1484
  int j;
1458
1485
 
1459
- Data_Get_Struct(rb_node, xmlNode, c_node);
1486
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
1460
1487
 
1461
1488
  namespaces = xmlGetNsList(c_node->doc, c_node);
1462
1489
  if (!namespaces) {
@@ -1481,7 +1508,7 @@ static VALUE
1481
1508
  node_type(VALUE self)
1482
1509
  {
1483
1510
  xmlNodePtr node;
1484
- Data_Get_Struct(self, xmlNode, node);
1511
+ Noko_Node_Get_Struct(self, xmlNode, node);
1485
1512
  return INT2NUM((long)node->type);
1486
1513
  }
1487
1514
 
@@ -1495,7 +1522,7 @@ static VALUE
1495
1522
  set_native_content(VALUE self, VALUE content)
1496
1523
  {
1497
1524
  xmlNodePtr node, child, next ;
1498
- Data_Get_Struct(self, xmlNode, node);
1525
+ Noko_Node_Get_Struct(self, xmlNode, node);
1499
1526
 
1500
1527
  child = node->children;
1501
1528
  while (NULL != child) {
@@ -1521,7 +1548,7 @@ set_lang(VALUE self_rb, VALUE lang_rb)
1521
1548
  xmlNodePtr self ;
1522
1549
  xmlChar *lang ;
1523
1550
 
1524
- Data_Get_Struct(self_rb, xmlNode, self);
1551
+ Noko_Node_Get_Struct(self_rb, xmlNode, self);
1525
1552
  lang = (xmlChar *)StringValueCStr(lang_rb);
1526
1553
 
1527
1554
  xmlNodeSetLang(self, lang);
@@ -1543,7 +1570,7 @@ get_lang(VALUE self_rb)
1543
1570
  xmlChar *lang ;
1544
1571
  VALUE lang_rb ;
1545
1572
 
1546
- Data_Get_Struct(self_rb, xmlNode, self);
1573
+ Noko_Node_Get_Struct(self_rb, xmlNode, self);
1547
1574
 
1548
1575
  lang = xmlNodeGetLang(self);
1549
1576
  if (lang) {
@@ -1572,7 +1599,7 @@ static VALUE
1572
1599
  get_parent(VALUE self)
1573
1600
  {
1574
1601
  xmlNodePtr node, parent;
1575
- Data_Get_Struct(self, xmlNode, node);
1602
+ Noko_Node_Get_Struct(self, xmlNode, node);
1576
1603
 
1577
1604
  parent = node->parent;
1578
1605
  if (!parent) { return Qnil; }
@@ -1590,7 +1617,7 @@ static VALUE
1590
1617
  set_name(VALUE self, VALUE new_name)
1591
1618
  {
1592
1619
  xmlNodePtr node;
1593
- Data_Get_Struct(self, xmlNode, node);
1620
+ Noko_Node_Get_Struct(self, xmlNode, node);
1594
1621
  xmlNodeSetName(node, (xmlChar *)StringValueCStr(new_name));
1595
1622
  return new_name;
1596
1623
  }
@@ -1605,7 +1632,7 @@ static VALUE
1605
1632
  get_name(VALUE self)
1606
1633
  {
1607
1634
  xmlNodePtr node;
1608
- Data_Get_Struct(self, xmlNode, node);
1635
+ Noko_Node_Get_Struct(self, xmlNode, node);
1609
1636
  if (node->name) {
1610
1637
  return NOKOGIRI_STR_NEW2(node->name);
1611
1638
  }
@@ -1625,7 +1652,7 @@ rb_xml_node_path(VALUE rb_node)
1625
1652
  xmlChar *c_path ;
1626
1653
  VALUE rval;
1627
1654
 
1628
- Data_Get_Struct(rb_node, xmlNode, c_node);
1655
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
1629
1656
 
1630
1657
  c_path = xmlGetNodePath(c_node);
1631
1658
  if (c_path == NULL) {
@@ -1674,7 +1701,7 @@ native_write_to(
1674
1701
  const char *before_indent;
1675
1702
  xmlSaveCtxtPtr savectx;
1676
1703
 
1677
- Data_Get_Struct(self, xmlNode, node);
1704
+ Noko_Node_Get_Struct(self, xmlNode, node);
1678
1705
 
1679
1706
  xmlIndentTreeOutput = 1;
1680
1707
 
@@ -1728,7 +1755,7 @@ static VALUE
1728
1755
  rb_xml_node_line(VALUE rb_node)
1729
1756
  {
1730
1757
  xmlNodePtr c_node;
1731
- Data_Get_Struct(rb_node, xmlNode, c_node);
1758
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
1732
1759
 
1733
1760
  return INT2NUM(xmlGetLineNo(c_node));
1734
1761
  }
@@ -1745,7 +1772,7 @@ rb_xml_node_line_set(VALUE rb_node, VALUE rb_line_number)
1745
1772
  xmlNodePtr c_node;
1746
1773
  int line_number = NUM2INT(rb_line_number);
1747
1774
 
1748
- Data_Get_Struct(rb_node, xmlNode, c_node);
1775
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
1749
1776
 
1750
1777
  // libxml2 optionally uses xmlNode.psvi to store longer line numbers, but only for text nodes.
1751
1778
  // search for "psvi" in SAX2.c and tree.c to learn more.
@@ -1781,7 +1808,7 @@ rb_xml_node_new(int argc, VALUE *argv, VALUE klass)
1781
1808
  // TODO: deprecate allowing Node
1782
1809
  rb_warn("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.");
1783
1810
  }
1784
- Data_Get_Struct(rb_document_node, xmlNode, c_document_node);
1811
+ Noko_Node_Get_Struct(rb_document_node, xmlNode, c_document_node);
1785
1812
 
1786
1813
  c_node = xmlNewNode(NULL, (xmlChar *)StringValueCStr(rb_name));
1787
1814
  c_node->doc = c_document_node->doc;
@@ -1811,7 +1838,7 @@ dump_html(VALUE self)
1811
1838
  xmlNodePtr node ;
1812
1839
  VALUE html;
1813
1840
 
1814
- Data_Get_Struct(self, xmlNode, node);
1841
+ Noko_Node_Get_Struct(self, xmlNode, node);
1815
1842
 
1816
1843
  buf = xmlBufferCreate() ;
1817
1844
  htmlNodeDump(buf, node->doc, node);
@@ -1830,8 +1857,8 @@ static VALUE
1830
1857
  compare(VALUE self, VALUE _other)
1831
1858
  {
1832
1859
  xmlNodePtr node, other;
1833
- Data_Get_Struct(self, xmlNode, node);
1834
- Data_Get_Struct(_other, xmlNode, other);
1860
+ Noko_Node_Get_Struct(self, xmlNode, node);
1861
+ Noko_Node_Get_Struct(_other, xmlNode, other);
1835
1862
 
1836
1863
  return INT2NUM((long)xmlXPathCmpNodes(other, node));
1837
1864
  }
@@ -1851,7 +1878,7 @@ process_xincludes(VALUE self, VALUE options)
1851
1878
  xmlNodePtr node;
1852
1879
  VALUE error_list = rb_ary_new();
1853
1880
 
1854
- Data_Get_Struct(self, xmlNode, node);
1881
+ Noko_Node_Get_Struct(self, xmlNode, node);
1855
1882
 
1856
1883
  xmlSetStructuredErrorFunc((void *)error_list, Nokogiri_error_array_pusher);
1857
1884
  rcode = xmlXIncludeProcessTreeFlags(node, (int)NUM2INT(options));
@@ -1882,7 +1909,7 @@ in_context(VALUE self, VALUE _str, VALUE _options)
1882
1909
  VALUE doc, err;
1883
1910
  int doc_is_empty;
1884
1911
 
1885
- Data_Get_Struct(self, xmlNode, node);
1912
+ Noko_Node_Get_Struct(self, xmlNode, node);
1886
1913
 
1887
1914
  doc = DOC_RUBY_OBJECT(node->doc);
1888
1915
  err = rb_iv_get(doc, "@errors");
@@ -1974,14 +2001,12 @@ in_context(VALUE self, VALUE _str, VALUE _options)
1974
2001
  return noko_xml_node_set_wrap(set, doc);
1975
2002
  }
1976
2003
 
1977
-
1978
2004
  VALUE
1979
2005
  noko_xml_node_wrap(VALUE rb_class, xmlNodePtr c_node)
1980
2006
  {
1981
2007
  VALUE rb_document, rb_node_cache, rb_node;
1982
2008
  nokogiriTuplePtr node_has_a_document;
1983
2009
  xmlDocPtr c_doc;
1984
- void (*f_mark)(xmlNodePtr) = NULL ;
1985
2010
 
1986
2011
  assert(c_node);
1987
2012
 
@@ -1989,11 +2014,9 @@ noko_xml_node_wrap(VALUE rb_class, xmlNodePtr c_node)
1989
2014
  return DOC_RUBY_OBJECT(c_node->doc);
1990
2015
  }
1991
2016
 
1992
- /* It's OK if the node doesn't have a fully-realized document (as in XML::Reader). */
1993
- /* see https://github.com/sparklemotion/nokogiri/issues/95 */
1994
- /* and https://github.com/sparklemotion/nokogiri/issues/439 */
1995
2017
  c_doc = c_node->doc;
1996
- if (c_doc->type == XML_DOCUMENT_FRAG_NODE) { c_doc = c_doc->doc; }
2018
+
2019
+ // Nodes yielded from XML::Reader don't have a fully-realized Document
1997
2020
  node_has_a_document = DOC_RUBY_OBJECT_TEST(c_doc);
1998
2021
 
1999
2022
  if (c_node->_private && node_has_a_document) {
@@ -2043,9 +2066,7 @@ noko_xml_node_wrap(VALUE rb_class, xmlNodePtr c_node)
2043
2066
  }
2044
2067
  }
2045
2068
 
2046
- f_mark = node_has_a_document ? _xml_node_mark : NULL ;
2047
-
2048
- rb_node = Data_Wrap_Struct(rb_class, f_mark, _xml_node_dealloc, c_node) ;
2069
+ rb_node = TypedData_Wrap_Struct(rb_class, &nokogiri_node_type, c_node) ;
2049
2070
  c_node->_private = (void *)rb_node;
2050
2071
 
2051
2072
  if (node_has_a_document) {
@@ -156,7 +156,7 @@ push(VALUE self, VALUE rb_node)
156
156
  Check_Node_Set_Node_Type(rb_node);
157
157
 
158
158
  Data_Get_Struct(self, xmlNodeSet, node_set);
159
- Data_Get_Struct(rb_node, xmlNode, node);
159
+ Noko_Node_Get_Struct(rb_node, xmlNode, node);
160
160
 
161
161
  xmlXPathNodeSetAdd(node_set, node);
162
162
 
@@ -179,7 +179,7 @@ delete (VALUE self, VALUE rb_node)
179
179
  Check_Node_Set_Node_Type(rb_node);
180
180
 
181
181
  Data_Get_Struct(self, xmlNodeSet, node_set);
182
- Data_Get_Struct(rb_node, xmlNode, node);
182
+ Noko_Node_Get_Struct(rb_node, xmlNode, node);
183
183
 
184
184
  if (xmlXPathNodeSetContains(node_set, node)) {
185
185
  xpath_node_set_del(node_set, node);
@@ -228,7 +228,7 @@ include_eh(VALUE self, VALUE rb_node)
228
228
  Check_Node_Set_Node_Type(rb_node);
229
229
 
230
230
  Data_Get_Struct(self, xmlNodeSet, node_set);
231
- Data_Get_Struct(rb_node, xmlNode, node);
231
+ Noko_Node_Get_Struct(rb_node, xmlNode, node);
232
232
 
233
233
  return (xmlXPathNodeSetContains(node_set, node) ? Qtrue : Qfalse);
234
234
  }
@@ -430,7 +430,7 @@ unlink_nodeset(VALUE self)
430
430
  xmlNodePtr node_ptr;
431
431
  node = noko_xml_node_wrap(Qnil, node_set->nodeTab[j]);
432
432
  rb_funcall(node, rb_intern("unlink"), 0); /* modifies the C struct out from under the object */
433
- Data_Get_Struct(node, xmlNode, node_ptr);
433
+ Noko_Node_Get_Struct(node, xmlNode, node_ptr);
434
434
  node_set->nodeTab[j] = node_ptr ;
435
435
  }
436
436
  }
@@ -2,6 +2,8 @@
2
2
 
3
3
  VALUE cNokogiriXmlSaxParserContext ;
4
4
 
5
+ static ID id_read;
6
+
5
7
  static void
6
8
  deallocate(xmlParserCtxtPtr ctxt)
7
9
  {
@@ -26,6 +28,10 @@ parse_io(VALUE klass, VALUE io, VALUE encoding)
26
28
  xmlParserCtxtPtr ctxt;
27
29
  xmlCharEncoding enc = (xmlCharEncoding)NUM2INT(encoding);
28
30
 
31
+ if (!rb_respond_to(io, id_read)) {
32
+ rb_raise(rb_eTypeError, "argument expected to respond to :read");
33
+ }
34
+
29
35
  ctxt = xmlCreateIOParserCtxt(NULL, NULL,
30
36
  (xmlInputReadCallback)noko_io_read,
31
37
  (xmlInputCloseCallback)noko_io_close,
@@ -62,9 +68,8 @@ parse_memory(VALUE klass, VALUE data)
62
68
  {
63
69
  xmlParserCtxtPtr ctxt;
64
70
 
65
- if (NIL_P(data)) {
66
- rb_raise(rb_eArgError, "data cannot be nil");
67
- }
71
+ Check_Type(data, T_STRING);
72
+
68
73
  if (!(int)RSTRING_LEN(data)) {
69
74
  rb_raise(rb_eRuntimeError, "data cannot be empty");
70
75
  }
@@ -278,4 +283,6 @@ noko_init_xml_sax_parser_context()
278
283
  rb_define_method(cNokogiriXmlSaxParserContext, "recovery", get_recovery, 0);
279
284
  rb_define_method(cNokogiriXmlSaxParserContext, "line", line, 0);
280
285
  rb_define_method(cNokogiriXmlSaxParserContext, "column", column, 0);
286
+
287
+ id_read = rb_intern("read");
281
288
  }
@@ -25,7 +25,7 @@ validate_document(VALUE self, VALUE document)
25
25
  VALUE errors;
26
26
 
27
27
  Data_Get_Struct(self, xmlSchema, schema);
28
- Data_Get_Struct(document, xmlDoc, doc);
28
+ Noko_Node_Get_Struct(document, xmlDoc, doc);
29
29
 
30
30
  errors = rb_ary_new();
31
31
 
@@ -179,7 +179,7 @@ has_blank_nodes_p(VALUE cache)
179
179
  for (i = 0; i < RARRAY_LEN(cache); i++) {
180
180
  xmlNodePtr node;
181
181
  VALUE element = rb_ary_entry(cache, i);
182
- Data_Get_Struct(element, xmlNode, node);
182
+ Noko_Node_Get_Struct(element, xmlNode, node);
183
183
  if (xmlIsBlankNode(node)) {
184
184
  return 1;
185
185
  }
@@ -210,7 +210,7 @@ from_document(int argc, VALUE *argv, VALUE klass)
210
210
 
211
211
  scanned_args = rb_scan_args(argc, argv, "11", &document, &parse_options);
212
212
 
213
- Data_Get_Struct(document, xmlDoc, doc);
213
+ Noko_Node_Get_Struct(document, xmlDoc, doc);
214
214
  doc = doc->doc; /* In case someone passes us a node. ugh. */
215
215
 
216
216
  if (scanned_args == 1) {
@@ -20,7 +20,7 @@ new (int argc, VALUE *argv, VALUE klass)
20
20
 
21
21
  rb_scan_args(argc, argv, "2*", &string, &document, &rest);
22
22
 
23
- Data_Get_Struct(document, xmlDoc, doc);
23
+ Noko_Node_Get_Struct(document, xmlDoc, doc);
24
24
 
25
25
  node = xmlNewText((xmlChar *)StringValueCStr(string));
26
26
  node->doc = doc->doc;
@@ -371,7 +371,7 @@ new (VALUE klass, VALUE nodeobj)
371
371
  xmlXPathContextPtr ctx;
372
372
  VALUE self;
373
373
 
374
- Data_Get_Struct(nodeobj, xmlNode, node);
374
+ Noko_Node_Get_Struct(nodeobj, xmlNode, node);
375
375
 
376
376
  xmlXPathInit();
377
377
 
Binary file
Binary file
Binary file
Binary file
@@ -28,7 +28,7 @@ module Nokogiri
28
28
  ###
29
29
  # Parse html stored in +data+ using +encoding+
30
30
  def parse_memory(data, encoding = "UTF-8")
31
- raise ArgumentError unless data
31
+ raise TypeError unless String === data
32
32
  return if data.empty?
33
33
 
34
34
  ctx = ParserContext.memory(data, encoding)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nokogiri
4
4
  # The version of Nokogiri you are using
5
- VERSION = "1.13.4"
5
+ VERSION = "1.13.7"
6
6
  end
@@ -123,8 +123,8 @@ module Nokogiri
123
123
  # [Yields] Nokogiri::XML::Node
124
124
  # [Returns] Nokogiri::XML::Node
125
125
  #
126
- def initialize(name, document) # rubocop:disable Style/RedundantInitialize
127
- # This is intentionally empty.
126
+ def initialize(name, document)
127
+ # This is intentionally empty, and sets the method signature for subclasses.
128
128
  end
129
129
 
130
130
  ###
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
4
+ version: 1.13.7
5
5
  platform: x86_64-linux
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-04-11 00:00:00.000000000 Z
23
+ date: 2022-07-12 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: racc
@@ -124,16 +124,16 @@ dependencies:
124
124
  name: rake-compiler-dock
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - "~>"
127
+ - - '='
128
128
  - !ruby/object:Gem::Version
129
- version: '1.2'
129
+ version: 1.2.2
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - "~>"
134
+ - - '='
135
135
  - !ruby/object:Gem::Version
136
- version: '1.2'
136
+ version: 1.2.2
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: rdoc
139
139
  requirement: !ruby/object:Gem::Requirement
@@ -168,14 +168,14 @@ dependencies:
168
168
  requirements:
169
169
  - - "~>"
170
170
  - !ruby/object:Gem::Version
171
- version: '1.23'
171
+ version: 1.30.1
172
172
  type: :development
173
173
  prerelease: false
174
174
  version_requirements: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - "~>"
177
177
  - !ruby/object:Gem::Version
178
- version: '1.23'
178
+ version: 1.30.1
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: rubocop-minitest
181
181
  requirement: !ruby/object:Gem::Requirement
@@ -222,16 +222,16 @@ dependencies:
222
222
  name: rubocop-shopify
223
223
  requirement: !ruby/object:Gem::Requirement
224
224
  requirements:
225
- - - "~>"
225
+ - - '='
226
226
  - !ruby/object:Gem::Version
227
- version: '2.3'
227
+ version: 2.5.0
228
228
  type: :development
229
229
  prerelease: false
230
230
  version_requirements: !ruby/object:Gem::Requirement
231
231
  requirements:
232
- - - "~>"
232
+ - - '='
233
233
  - !ruby/object:Gem::Version
234
- version: '2.3'
234
+ version: 2.5.0
235
235
  - !ruby/object:Gem::Dependency
236
236
  name: ruby_memcheck
237
237
  requirement: !ruby/object:Gem::Requirement