nokogiri 1.6.8.rc1-java → 1.6.8.rc2-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.

Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +2 -0
  3. data/CHANGELOG.rdoc +16 -2
  4. data/Gemfile +2 -2
  5. data/LICENSE.txt +1 -1
  6. data/Manifest.txt +0 -1
  7. data/Rakefile +5 -3
  8. data/ext/java/nokogiri/HtmlElementDescription.java +5 -2
  9. data/ext/java/nokogiri/NokogiriService.java +19 -0
  10. data/ext/java/nokogiri/XmlNode.java +7 -0
  11. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +8 -1
  12. data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +1 -2
  13. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +1 -1
  14. data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +0 -1
  15. data/ext/java/nokogiri/internals/ParserContext.java +4 -0
  16. data/ext/java/nokogiri/internals/SaveContextVisitor.java +13 -12
  17. data/ext/nokogiri/extconf.rb +1 -2
  18. data/ext/nokogiri/html_document.c +6 -6
  19. data/ext/nokogiri/html_element_description.c +1 -1
  20. data/ext/nokogiri/html_entity_lookup.c +1 -1
  21. data/ext/nokogiri/html_sax_parser_context.c +4 -4
  22. data/ext/nokogiri/html_sax_push_parser.c +2 -2
  23. data/ext/nokogiri/xml_attr.c +2 -2
  24. data/ext/nokogiri/xml_comment.c +1 -1
  25. data/ext/nokogiri/xml_document.c +18 -18
  26. data/ext/nokogiri/xml_encoding_handler.c +3 -3
  27. data/ext/nokogiri/xml_entity_reference.c +1 -1
  28. data/ext/nokogiri/xml_node.c +27 -27
  29. data/ext/nokogiri/xml_node_set.c +3 -11
  30. data/ext/nokogiri/xml_processing_instruction.c +2 -2
  31. data/ext/nokogiri/xml_reader.c +6 -6
  32. data/ext/nokogiri/xml_sax_parser_context.c +1 -1
  33. data/ext/nokogiri/xml_sax_push_parser.c +1 -1
  34. data/ext/nokogiri/xml_schema.c +1 -1
  35. data/ext/nokogiri/xml_text.c +1 -1
  36. data/ext/nokogiri/xml_xpath_context.c +6 -6
  37. data/ext/nokogiri/xslt_stylesheet.c +6 -6
  38. data/lib/nekohtml.jar +0 -0
  39. data/lib/nokogiri/nokogiri.jar +0 -0
  40. data/lib/nokogiri/version.rb +1 -1
  41. data/lib/nokogiri/xml/node.rb +5 -9
  42. data/lib/nokogiri/xml/node_set.rb +3 -3
  43. data/test/html/test_document.rb +3 -3
  44. data/test/html/test_document_encoding.rb +4 -4
  45. data/test/html/test_node_encoding.rb +60 -0
  46. data/test/test_css_cache.rb +1 -1
  47. data/test/test_reader.rb +19 -19
  48. data/test/xml/sax/test_parser.rb +3 -7
  49. data/test/xml/test_document_encoding.rb +3 -3
  50. data/test/xml/test_namespace.rb +2 -2
  51. data/test/xml/test_node.rb +4 -4
  52. data/test/xml/test_node_encoding.rb +33 -69
  53. data/test/xml/test_node_set.rb +1 -1
  54. data/test/xml/test_unparented_node.rb +1 -1
  55. data/test_all +15 -9
  56. metadata +4 -6
  57. data/CHANGELOG.ja.rdoc +0 -1075
@@ -181,7 +181,7 @@ static VALUE set_encoding(VALUE self, VALUE encoding)
181
181
  if (doc->encoding)
182
182
  free((char *) doc->encoding); /* this may produce a gcc cast warning */
183
183
 
184
- doc->encoding = xmlStrdup((xmlChar *)StringValuePtr(encoding));
184
+ doc->encoding = xmlStrdup((xmlChar *)StringValueCStr(encoding));
185
185
 
186
186
  return encoding;
187
187
  }
@@ -228,8 +228,8 @@ static VALUE read_io( VALUE klass,
228
228
  VALUE encoding,
229
229
  VALUE options )
230
230
  {
231
- const char * c_url = NIL_P(url) ? NULL : StringValuePtr(url);
232
- const char * c_enc = NIL_P(encoding) ? NULL : StringValuePtr(encoding);
231
+ const char * c_url = NIL_P(url) ? NULL : StringValueCStr(url);
232
+ const char * c_enc = NIL_P(encoding) ? NULL : StringValueCStr(encoding);
233
233
  VALUE error_list = rb_ary_new();
234
234
  VALUE document;
235
235
  xmlDocPtr doc;
@@ -279,8 +279,8 @@ static VALUE read_memory( VALUE klass,
279
279
  VALUE options )
280
280
  {
281
281
  const char * c_buffer = StringValuePtr(string);
282
- const char * c_url = NIL_P(url) ? NULL : StringValuePtr(url);
283
- const char * c_enc = NIL_P(encoding) ? NULL : StringValuePtr(encoding);
282
+ const char * c_url = NIL_P(url) ? NULL : StringValueCStr(url);
283
+ const char * c_enc = NIL_P(encoding) ? NULL : StringValueCStr(encoding);
284
284
  int len = (int)RSTRING_LEN(string);
285
285
  VALUE error_list = rb_ary_new();
286
286
  VALUE document;
@@ -355,7 +355,7 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
355
355
  version = rb_ary_entry(rest, (long)0);
356
356
  if (NIL_P(version)) version = rb_str_new2("1.0");
357
357
 
358
- doc = xmlNewDoc((xmlChar *)StringValuePtr(version));
358
+ doc = xmlNewDoc((xmlChar *)StringValueCStr(version));
359
359
  rb_doc = Nokogiri_wrap_xml_document(klass, doc);
360
360
  rb_obj_call_init(rb_doc, argc, argv);
361
361
  return rb_doc ;
@@ -383,13 +383,13 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
383
383
  * </bicycle>
384
384
  * </root>
385
385
  * EOXML
386
- *
386
+ *
387
387
  * doc.xpath("//tire").to_s # => ""
388
388
  * doc.xpath("//part:tire", "part" => "http://general-motors.com/").to_s # => "<part:tire>Michelin Model XGV</part:tire>"
389
389
  * doc.xpath("//part:tire", "part" => "http://schwinn.com/").to_s # => "<part:tire>I'm a bicycle tire!</part:tire>"
390
- *
390
+ *
391
391
  * doc.remove_namespaces!
392
- *
392
+ *
393
393
  * doc.xpath("//tire").to_s # => "<tire>Michelin Model XGV</tire><tire>I'm a bicycle tire!</tire>"
394
394
  * doc.xpath("//part:tire", "part" => "http://general-motors.com/").to_s # => ""
395
395
  * doc.xpath("//part:tire", "part" => "http://schwinn.com/").to_s # => ""
@@ -436,11 +436,11 @@ static VALUE create_entity(int argc, VALUE *argv, VALUE self)
436
436
  xmlResetLastError();
437
437
  ptr = xmlAddDocEntity(
438
438
  doc,
439
- (xmlChar *)(NIL_P(name) ? NULL : StringValuePtr(name)),
439
+ (xmlChar *)(NIL_P(name) ? NULL : StringValueCStr(name)),
440
440
  (int) (NIL_P(type) ? XML_INTERNAL_GENERAL_ENTITY : NUM2INT(type)),
441
- (xmlChar *)(NIL_P(external_id) ? NULL : StringValuePtr(external_id)),
442
- (xmlChar *)(NIL_P(system_id) ? NULL : StringValuePtr(system_id)),
443
- (xmlChar *)(NIL_P(content) ? NULL : StringValuePtr(content))
441
+ (xmlChar *)(NIL_P(external_id) ? NULL : StringValueCStr(external_id)),
442
+ (xmlChar *)(NIL_P(system_id) ? NULL : StringValueCStr(system_id)),
443
+ (xmlChar *)(NIL_P(content) ? NULL : StringValueCStr(content))
444
444
  );
445
445
 
446
446
  if(NULL == ptr) {
@@ -484,9 +484,9 @@ static int block_caller(void * ctx, xmlNodePtr _node, xmlNodePtr _parent)
484
484
  * doc.canonicalize { |obj, parent| ... }
485
485
  *
486
486
  * Canonicalize a document and return the results. Takes an optional block
487
- * that takes two parameters: the +obj+ and that node's +parent+.
487
+ * that takes two parameters: the +obj+ and that node's +parent+.
488
488
  * The +obj+ will be either a Nokogiri::XML::Node, or a Nokogiri::XML::Namespace
489
- * The block must return a non-nil, non-false value if the +obj+ passed in
489
+ * The block must return a non-nil, non-false value if the +obj+ passed in
490
490
  * should be included in the canonicalized document.
491
491
  */
492
492
  static VALUE canonicalize(int argc, VALUE* argv, VALUE self)
@@ -531,14 +531,14 @@ static VALUE canonicalize(int argc, VALUE* argv, VALUE self)
531
531
  ns = calloc((size_t)ns_len+1, sizeof(xmlChar *));
532
532
  for (i = 0 ; i < ns_len ; i++) {
533
533
  VALUE entry = rb_ary_entry(incl_ns, i);
534
- const char * ptr = StringValuePtr(entry);
534
+ const char * ptr = StringValueCStr(entry);
535
535
  ns[i] = (xmlChar*) ptr;
536
536
  }
537
537
  }
538
538
 
539
539
 
540
- xmlC14NExecute(doc, cb, ctx,
541
- (int) (NIL_P(mode) ? 0 : NUM2INT(mode)),
540
+ xmlC14NExecute(doc, cb, ctx,
541
+ (int) (NIL_P(mode) ? 0 : NUM2INT(mode)),
542
542
  ns,
543
543
  (int) RTEST(with_comments),
544
544
  buf);
@@ -9,7 +9,7 @@ static VALUE get(VALUE klass, VALUE key)
9
9
  {
10
10
  xmlCharEncodingHandlerPtr handler;
11
11
 
12
- handler = xmlFindCharEncodingHandler(StringValuePtr(key));
12
+ handler = xmlFindCharEncodingHandler(StringValueCStr(key));
13
13
  if(handler)
14
14
  return Data_Wrap_Struct(klass, NULL, NULL, handler);
15
15
 
@@ -23,7 +23,7 @@ static VALUE get(VALUE klass, VALUE key)
23
23
  */
24
24
  static VALUE delete(VALUE klass, VALUE name)
25
25
  {
26
- if(xmlDelEncodingAlias(StringValuePtr(name))) return Qnil;
26
+ if(xmlDelEncodingAlias(StringValueCStr(name))) return Qnil;
27
27
 
28
28
  return Qtrue;
29
29
  }
@@ -35,7 +35,7 @@ static VALUE delete(VALUE klass, VALUE name)
35
35
  */
36
36
  static VALUE alias(VALUE klass, VALUE from, VALUE to)
37
37
  {
38
- xmlAddEncodingAlias(StringValuePtr(from), StringValuePtr(to));
38
+ xmlAddEncodingAlias(StringValueCStr(from), StringValueCStr(to));
39
39
 
40
40
  return to;
41
41
  }
@@ -21,7 +21,7 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
21
21
 
22
22
  node = xmlNewReference(
23
23
  xml_doc,
24
- (const xmlChar *)StringValuePtr(name)
24
+ (const xmlChar *)StringValueCStr(name)
25
25
  );
26
26
 
27
27
  nokogiri_root_node(node);
@@ -331,7 +331,7 @@ static VALUE encode_special_chars(VALUE self, VALUE string)
331
331
  Data_Get_Struct(self, xmlNode, node);
332
332
  encoded = xmlEncodeSpecialChars(
333
333
  node->doc,
334
- (const xmlChar *)StringValuePtr(string)
334
+ (const xmlChar *)StringValueCStr(string)
335
335
  );
336
336
 
337
337
  encoded_str = NOKOGIRI_STR_NEW2(encoded);
@@ -367,9 +367,9 @@ static VALUE create_internal_subset(VALUE self, VALUE name, VALUE external_id, V
367
367
 
368
368
  dtd = xmlCreateIntSubset(
369
369
  doc,
370
- NIL_P(name) ? NULL : (const xmlChar *)StringValuePtr(name),
371
- NIL_P(external_id) ? NULL : (const xmlChar *)StringValuePtr(external_id),
372
- NIL_P(system_id) ? NULL : (const xmlChar *)StringValuePtr(system_id)
370
+ NIL_P(name) ? NULL : (const xmlChar *)StringValueCStr(name),
371
+ NIL_P(external_id) ? NULL : (const xmlChar *)StringValueCStr(external_id),
372
+ NIL_P(system_id) ? NULL : (const xmlChar *)StringValueCStr(system_id)
373
373
  );
374
374
 
375
375
  if(!dtd) return Qnil;
@@ -398,9 +398,9 @@ static VALUE create_external_subset(VALUE self, VALUE name, VALUE external_id, V
398
398
 
399
399
  dtd = xmlNewDtd(
400
400
  doc,
401
- NIL_P(name) ? NULL : (const xmlChar *)StringValuePtr(name),
402
- NIL_P(external_id) ? NULL : (const xmlChar *)StringValuePtr(external_id),
403
- NIL_P(system_id) ? NULL : (const xmlChar *)StringValuePtr(system_id)
401
+ NIL_P(name) ? NULL : (const xmlChar *)StringValueCStr(name),
402
+ NIL_P(external_id) ? NULL : (const xmlChar *)StringValueCStr(external_id),
403
+ NIL_P(system_id) ? NULL : (const xmlChar *)StringValueCStr(system_id)
404
404
  );
405
405
 
406
406
  if(!dtd) return Qnil;
@@ -737,7 +737,7 @@ static VALUE key_eh(VALUE self, VALUE attribute)
737
737
  {
738
738
  xmlNodePtr node;
739
739
  Data_Get_Struct(self, xmlNode, node);
740
- if(xmlHasProp(node, (xmlChar *)StringValuePtr(attribute)))
740
+ if(xmlHasProp(node, (xmlChar *)StringValueCStr(attribute)))
741
741
  return Qtrue;
742
742
  return Qfalse;
743
743
  }
@@ -752,8 +752,8 @@ static VALUE namespaced_key_eh(VALUE self, VALUE attribute, VALUE namespace)
752
752
  {
753
753
  xmlNodePtr node;
754
754
  Data_Get_Struct(self, xmlNode, node);
755
- if(xmlHasNsProp(node, (xmlChar *)StringValuePtr(attribute),
756
- NIL_P(namespace) ? NULL : (xmlChar *)StringValuePtr(namespace)))
755
+ if(xmlHasNsProp(node, (xmlChar *)StringValueCStr(attribute),
756
+ NIL_P(namespace) ? NULL : (xmlChar *)StringValueCStr(namespace)))
757
757
  return Qtrue;
758
758
  return Qfalse;
759
759
  }
@@ -778,7 +778,7 @@ static VALUE set(VALUE self, VALUE property, VALUE value)
778
778
  */
779
779
  if (node->type != XML_ELEMENT_NODE)
780
780
  return(Qnil);
781
- prop = xmlHasProp(node, (xmlChar *)StringValuePtr(property));
781
+ prop = xmlHasProp(node, (xmlChar *)StringValueCStr(property));
782
782
  if (prop && prop->children) {
783
783
  for (cur = prop->children; cur; cur = cur->next) {
784
784
  if (cur->_private) {
@@ -788,8 +788,8 @@ static VALUE set(VALUE self, VALUE property, VALUE value)
788
788
  }
789
789
  }
790
790
 
791
- xmlSetProp(node, (xmlChar *)StringValuePtr(property),
792
- (xmlChar *)StringValuePtr(value));
791
+ xmlSetProp(node, (xmlChar *)StringValueCStr(property),
792
+ (xmlChar *)StringValueCStr(value));
793
793
 
794
794
  return value;
795
795
  }
@@ -812,7 +812,7 @@ static VALUE get(VALUE self, VALUE rattribute)
812
812
  if (NIL_P(rattribute)) return Qnil;
813
813
 
814
814
  Data_Get_Struct(self, xmlNode, node);
815
- attribute = strdup(StringValuePtr(rattribute));
815
+ attribute = strdup(StringValueCStr(rattribute));
816
816
 
817
817
  colon = strchr(attribute, ':');
818
818
  if (colon) {
@@ -823,7 +823,7 @@ static VALUE get(VALUE self, VALUE rattribute)
823
823
  if (ns) {
824
824
  value = xmlGetNsProp(node, (xmlChar*)(attr_name), ns->href);
825
825
  } else {
826
- value = xmlGetProp(node, (xmlChar*)StringValuePtr(rattribute));
826
+ value = xmlGetProp(node, (xmlChar*)StringValueCStr(rattribute));
827
827
  }
828
828
  } else {
829
829
  value = xmlGetNoNsProp(node, (xmlChar*)attribute);
@@ -870,7 +870,7 @@ static VALUE attr(VALUE self, VALUE name)
870
870
  xmlNodePtr node;
871
871
  xmlAttrPtr prop;
872
872
  Data_Get_Struct(self, xmlNode, node);
873
- prop = xmlHasProp(node, (xmlChar *)StringValuePtr(name));
873
+ prop = xmlHasProp(node, (xmlChar *)StringValueCStr(name));
874
874
 
875
875
  if(! prop) return Qnil;
876
876
  return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)prop);
@@ -887,8 +887,8 @@ static VALUE attribute_with_ns(VALUE self, VALUE name, VALUE namespace)
887
887
  xmlNodePtr node;
888
888
  xmlAttrPtr prop;
889
889
  Data_Get_Struct(self, xmlNode, node);
890
- prop = xmlHasNsProp(node, (xmlChar *)StringValuePtr(name),
891
- NIL_P(namespace) ? NULL : (xmlChar *)StringValuePtr(namespace));
890
+ prop = xmlHasNsProp(node, (xmlChar *)StringValueCStr(name),
891
+ NIL_P(namespace) ? NULL : (xmlChar *)StringValueCStr(namespace));
892
892
 
893
893
  if(! prop) return Qnil;
894
894
  return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)prop);
@@ -1025,7 +1025,7 @@ static VALUE set_native_content(VALUE self, VALUE content)
1025
1025
  child = next ;
1026
1026
  }
1027
1027
 
1028
- xmlNodeSetContent(node, (xmlChar *)StringValuePtr(content));
1028
+ xmlNodeSetContent(node, (xmlChar *)StringValueCStr(content));
1029
1029
  return content;
1030
1030
  }
1031
1031
 
@@ -1063,7 +1063,7 @@ static VALUE set_lang(VALUE self_rb, VALUE lang_rb)
1063
1063
  xmlChar* lang ;
1064
1064
 
1065
1065
  Data_Get_Struct(self_rb, xmlNode, self);
1066
- lang = (xmlChar*)StringValuePtr(lang_rb);
1066
+ lang = (xmlChar*)StringValueCStr(lang_rb);
1067
1067
 
1068
1068
  xmlNodeSetLang(self, lang);
1069
1069
 
@@ -1128,7 +1128,7 @@ static VALUE set_name(VALUE self, VALUE new_name)
1128
1128
  {
1129
1129
  xmlNodePtr node;
1130
1130
  Data_Get_Struct(self, xmlNode, node);
1131
- xmlNodeSetName(node, (xmlChar*)StringValuePtr(new_name));
1131
+ xmlNodeSetName(node, (xmlChar*)StringValueCStr(new_name));
1132
1132
  return new_name;
1133
1133
  }
1134
1134
 
@@ -1202,13 +1202,13 @@ static VALUE native_write_to(
1202
1202
 
1203
1203
  before_indent = xmlTreeIndentString;
1204
1204
 
1205
- xmlTreeIndentString = StringValuePtr(indent_string);
1205
+ xmlTreeIndentString = StringValueCStr(indent_string);
1206
1206
 
1207
1207
  savectx = xmlSaveToIO(
1208
1208
  (xmlOutputWriteCallback)io_write_callback,
1209
1209
  (xmlOutputCloseCallback)io_close_callback,
1210
1210
  (void *)io,
1211
- RTEST(encoding) ? StringValuePtr(encoding) : NULL,
1211
+ RTEST(encoding) ? StringValueCStr(encoding) : NULL,
1212
1212
  (int)NUM2INT(options)
1213
1213
  );
1214
1214
 
@@ -1255,7 +1255,7 @@ static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href)
1255
1255
  ns = xmlSearchNs(
1256
1256
  node->doc,
1257
1257
  node,
1258
- (const xmlChar *)(NIL_P(prefix) ? NULL : StringValuePtr(prefix))
1258
+ (const xmlChar *)(NIL_P(prefix) ? NULL : StringValueCStr(prefix))
1259
1259
  );
1260
1260
 
1261
1261
  if(!ns) {
@@ -1264,8 +1264,8 @@ static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href)
1264
1264
  }
1265
1265
  ns = xmlNewNs(
1266
1266
  namespacee,
1267
- (const xmlChar *)StringValuePtr(href),
1268
- (const xmlChar *)(NIL_P(prefix) ? NULL : StringValuePtr(prefix))
1267
+ (const xmlChar *)StringValueCStr(href),
1268
+ (const xmlChar *)(NIL_P(prefix) ? NULL : StringValueCStr(prefix))
1269
1269
  );
1270
1270
  }
1271
1271
 
@@ -1295,7 +1295,7 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
1295
1295
 
1296
1296
  Data_Get_Struct(document, xmlDoc, doc);
1297
1297
 
1298
- node = xmlNewNode(NULL, (xmlChar *)StringValuePtr(name));
1298
+ node = xmlNewNode(NULL, (xmlChar *)StringValueCStr(name));
1299
1299
  node->doc = doc->doc;
1300
1300
  nokogiri_root_node(node);
1301
1301
 
@@ -321,25 +321,17 @@ static VALUE slice(int argc, VALUE *argv, VALUE self)
321
321
  static VALUE to_array(VALUE self, VALUE rb_node)
322
322
  {
323
323
  xmlNodeSetPtr node_set ;
324
- VALUE *elts;
325
324
  VALUE list;
326
325
  int i;
327
326
 
328
327
  Data_Get_Struct(self, xmlNodeSet, node_set);
329
328
 
330
- elts = (VALUE *)calloc((size_t)(node_set->nodeNr), sizeof(VALUE));
329
+ list = rb_ary_new2(node_set->nodeNr);
331
330
  for(i = 0; i < node_set->nodeNr; i++) {
332
- elts[i] = Nokogiri_wrap_xml_node_set_node(node_set->nodeTab[i], self);
333
- rb_gc_register_address(&elts[i]);
331
+ VALUE elt = Nokogiri_wrap_xml_node_set_node(node_set->nodeTab[i], self);
332
+ rb_ary_push( list, elt );
334
333
  }
335
334
 
336
- list = rb_ary_new4((long)node_set->nodeNr, elts);
337
-
338
- for(i = 0; i < node_set->nodeNr; i++) {
339
- rb_gc_unregister_address(&elts[i]);
340
- }
341
- free(elts);
342
-
343
335
  return list;
344
336
  }
345
337
 
@@ -23,8 +23,8 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
23
23
 
24
24
  node = xmlNewDocPI(
25
25
  xml_doc,
26
- (const xmlChar *)StringValuePtr(name),
27
- (const xmlChar *)StringValuePtr(content)
26
+ (const xmlChar *)StringValueCStr(name),
27
+ (const xmlChar *)StringValueCStr(content)
28
28
  );
29
29
 
30
30
  nokogiri_root_node(node);
@@ -218,12 +218,12 @@ static VALUE reader_attribute(VALUE self, VALUE name)
218
218
  if(NIL_P(name)) return Qnil;
219
219
  name = StringValue(name) ;
220
220
 
221
- value = xmlTextReaderGetAttribute(reader, (xmlChar*)StringValuePtr(name));
221
+ value = xmlTextReaderGetAttribute(reader, (xmlChar*)StringValueCStr(name));
222
222
  if(value == NULL) {
223
223
  /* this section is an attempt to workaround older versions of libxml that
224
224
  don't handle namespaces properly in all attribute-and-friends functions */
225
225
  xmlChar *prefix = NULL ;
226
- xmlChar *localname = xmlSplitQName2((xmlChar*)StringValuePtr(name), &prefix);
226
+ xmlChar *localname = xmlSplitQName2((xmlChar*)StringValueCStr(name), &prefix);
227
227
  if (localname != NULL) {
228
228
  value = xmlTextReaderLookupNamespace(reader, localname);
229
229
  xmlFree(localname) ;
@@ -546,8 +546,8 @@ static VALUE from_memory(int argc, VALUE *argv, VALUE klass)
546
546
  rb_scan_args(argc, argv, "13", &rb_buffer, &rb_url, &encoding, &rb_options);
547
547
 
548
548
  if (!RTEST(rb_buffer)) rb_raise(rb_eArgError, "string cannot be nil");
549
- if (RTEST(rb_url)) c_url = StringValuePtr(rb_url);
550
- if (RTEST(encoding)) c_encoding = StringValuePtr(encoding);
549
+ if (RTEST(rb_url)) c_url = StringValueCStr(rb_url);
550
+ if (RTEST(encoding)) c_encoding = StringValueCStr(encoding);
551
551
  if (RTEST(rb_options)) c_options = (int)NUM2INT(rb_options);
552
552
 
553
553
  reader = xmlReaderForMemory(
@@ -590,8 +590,8 @@ static VALUE from_io(int argc, VALUE *argv, VALUE klass)
590
590
  rb_scan_args(argc, argv, "13", &rb_io, &rb_url, &encoding, &rb_options);
591
591
 
592
592
  if (!RTEST(rb_io)) rb_raise(rb_eArgError, "io cannot be nil");
593
- if (RTEST(rb_url)) c_url = StringValuePtr(rb_url);
594
- if (RTEST(encoding)) c_encoding = StringValuePtr(encoding);
593
+ if (RTEST(rb_url)) c_url = StringValueCStr(rb_url);
594
+ if (RTEST(encoding)) c_encoding = StringValueCStr(encoding);
595
595
  if (RTEST(rb_options)) c_options = (int)NUM2INT(rb_options);
596
596
 
597
597
  reader = xmlReaderForIO(
@@ -45,7 +45,7 @@ parse_io(VALUE klass, VALUE io, VALUE encoding)
45
45
  */
46
46
  static VALUE parse_file(VALUE klass, VALUE filename)
47
47
  {
48
- xmlParserCtxtPtr ctxt = xmlCreateFileParserCtxt(StringValuePtr(filename));
48
+ xmlParserCtxtPtr ctxt = xmlCreateFileParserCtxt(StringValueCStr(filename));
49
49
  return Data_Wrap_Struct(klass, NULL, deallocate, ctxt);
50
50
  }
51
51
 
@@ -59,7 +59,7 @@ static VALUE initialize_native(VALUE self, VALUE _xml_sax, VALUE _filename)
59
59
 
60
60
  Data_Get_Struct(_xml_sax, xmlSAXHandler, sax);
61
61
 
62
- if(_filename != Qnil) filename = StringValuePtr(_filename);
62
+ if(_filename != Qnil) filename = StringValueCStr(_filename);
63
63
 
64
64
  ctx = xmlCreatePushParserCtxt(
65
65
  sax,
@@ -61,7 +61,7 @@ static VALUE validate_file(VALUE self, VALUE rb_filename)
61
61
  VALUE errors;
62
62
 
63
63
  Data_Get_Struct(self, xmlSchema, schema);
64
- filename = (const char*)StringValuePtr(rb_filename) ;
64
+ filename = (const char*)StringValueCStr(rb_filename) ;
65
65
 
66
66
  errors = rb_ary_new();
67
67
 
@@ -19,7 +19,7 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
19
19
 
20
20
  Data_Get_Struct(document, xmlDoc, doc);
21
21
 
22
- node = xmlNewText((xmlChar *)StringValuePtr(string));
22
+ node = xmlNewText((xmlChar *)StringValueCStr(string));
23
23
  node->doc = doc->doc;
24
24
 
25
25
  nokogiri_root_node(node);
@@ -21,8 +21,8 @@ static VALUE register_ns(VALUE self, VALUE prefix, VALUE uri)
21
21
  Data_Get_Struct(self, xmlXPathContext, ctx);
22
22
 
23
23
  xmlXPathRegisterNs( ctx,
24
- (const xmlChar *)StringValuePtr(prefix),
25
- (const xmlChar *)StringValuePtr(uri)
24
+ (const xmlChar *)StringValueCStr(prefix),
25
+ (const xmlChar *)StringValueCStr(uri)
26
26
  );
27
27
  return self;
28
28
  }
@@ -39,10 +39,10 @@ static VALUE register_variable(VALUE self, VALUE name, VALUE value)
39
39
  xmlXPathObjectPtr xmlValue;
40
40
  Data_Get_Struct(self, xmlXPathContext, ctx);
41
41
 
42
- xmlValue = xmlXPathNewCString(StringValuePtr(value));
42
+ xmlValue = xmlXPathNewCString(StringValueCStr(value));
43
43
 
44
44
  xmlXPathRegisterVariable( ctx,
45
- (const xmlChar *)StringValuePtr(name),
45
+ (const xmlChar *)StringValueCStr(name),
46
46
  xmlValue
47
47
  );
48
48
 
@@ -108,7 +108,7 @@ void Nokogiri_marshal_xpath_funcall_and_return_values(xmlXPathParserContextPtr c
108
108
  case T_STRING:
109
109
  xmlXPathReturnString(
110
110
  ctx,
111
- xmlCharStrdup(StringValuePtr(result))
111
+ xmlCharStrdup(StringValueCStr(result))
112
112
  );
113
113
  break;
114
114
  case T_TRUE:
@@ -200,7 +200,7 @@ static VALUE evaluate(int argc, VALUE *argv, VALUE self)
200
200
  if(rb_scan_args(argc, argv, "11", &search_path, &xpath_handler) == 1)
201
201
  xpath_handler = Qnil;
202
202
 
203
- query = (xmlChar *)StringValuePtr(search_path);
203
+ query = (xmlChar *)StringValueCStr(search_path);
204
204
 
205
205
  if(Qnil != xpath_handler) {
206
206
  /* FIXME: not sure if this is the correct place to shove private data. */