libxml-ruby 3.2.1 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY +37 -0
  3. data/Rakefile +24 -16
  4. data/ext/libxml/libxml.c +0 -1
  5. data/ext/libxml/libxml_ruby.def +0 -1
  6. data/ext/libxml/ruby_libxml.h +0 -23
  7. data/ext/libxml/ruby_xml.c +3 -37
  8. data/ext/libxml/ruby_xml.h +1 -1
  9. data/ext/libxml/ruby_xml_cbg.c +1 -1
  10. data/ext/libxml/ruby_xml_document.c +6 -0
  11. data/ext/libxml/ruby_xml_dtd.c +1 -1
  12. data/ext/libxml/ruby_xml_encoding.c +2 -2
  13. data/ext/libxml/ruby_xml_encoding.h +2 -0
  14. data/ext/libxml/ruby_xml_error.c +3 -3
  15. data/ext/libxml/ruby_xml_error.h +3 -1
  16. data/ext/libxml/ruby_xml_html_parser.c +2 -0
  17. data/ext/libxml/ruby_xml_html_parser_context.c +1 -1
  18. data/ext/libxml/ruby_xml_html_parser_options.c +2 -0
  19. data/ext/libxml/ruby_xml_input_cbg.c +4 -7
  20. data/ext/libxml/ruby_xml_io.c +1 -1
  21. data/ext/libxml/ruby_xml_namespace.c +1 -0
  22. data/ext/libxml/ruby_xml_node.c +11 -15
  23. data/ext/libxml/ruby_xml_parser.h +0 -2
  24. data/ext/libxml/ruby_xml_parser_context.c +2 -0
  25. data/ext/libxml/ruby_xml_parser_options.h +0 -2
  26. data/ext/libxml/ruby_xml_reader.c +3 -0
  27. data/ext/libxml/ruby_xml_reader.h +0 -3
  28. data/ext/libxml/ruby_xml_relaxng.c +2 -0
  29. data/ext/libxml/ruby_xml_relaxng.h +0 -2
  30. data/ext/libxml/ruby_xml_schema.c +223 -81
  31. data/ext/libxml/ruby_xml_schema.h +4 -788
  32. data/ext/libxml/ruby_xml_schema_attribute.c +69 -71
  33. data/ext/libxml/ruby_xml_schema_attribute.h +25 -3
  34. data/ext/libxml/ruby_xml_schema_element.c +28 -54
  35. data/ext/libxml/ruby_xml_schema_element.h +0 -3
  36. data/ext/libxml/ruby_xml_schema_facet.c +19 -21
  37. data/ext/libxml/ruby_xml_schema_facet.h +0 -4
  38. data/ext/libxml/ruby_xml_schema_type.c +56 -37
  39. data/ext/libxml/ruby_xml_version.h +4 -4
  40. data/ext/libxml/ruby_xml_writer.c +4 -0
  41. data/ext/libxml/ruby_xml_writer.h +0 -4
  42. data/ext/libxml/ruby_xml_xinclude.c +4 -0
  43. data/ext/libxml/ruby_xml_xpath.c +1 -0
  44. data/ext/libxml/ruby_xml_xpath.h +2 -0
  45. data/ext/libxml/ruby_xml_xpath_context.c +2 -0
  46. data/ext/libxml/ruby_xml_xpath_object.c +1 -0
  47. data/lib/libxml/error.rb +7 -7
  48. data/libxml-ruby.gemspec +1 -1
  49. data/test/model/shiporder.rnc +2 -2
  50. data/test/model/shiporder.rng +2 -2
  51. data/test/model/shiporder.xsd +7 -3
  52. data/test/model/shiporder_bad.xsd +40 -0
  53. data/test/model/shiporder_import.xsd +45 -0
  54. data/test/test_document.rb +2 -1
  55. data/test/test_dtd.rb +2 -1
  56. data/test/test_error.rb +173 -157
  57. data/test/test_helper.rb +6 -0
  58. data/test/test_parser.rb +1 -1
  59. data/test/test_parser_context.rb +1 -7
  60. data/test/test_reader.rb +2 -1
  61. data/test/test_sax_parser.rb +13 -6
  62. data/test/test_schema.rb +92 -29
  63. data/test/test_xml.rb +12 -7
  64. metadata +11 -18
  65. data/MANIFEST +0 -166
  66. data/ext/libxml/ruby_xml_xpointer.c +0 -99
  67. data/ext/libxml/ruby_xml_xpointer.h +0 -11
  68. data/setup.rb +0 -1584
  69. data/test/test.xml +0 -2
  70. data/test/test_suite.rb +0 -48
  71. data/test/test_xpointer.rb +0 -72
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8b07d4dd732e06fdc8d4ffefcc9f9ea4a2a70faf8504bfdc1ef064e466656f9
4
- data.tar.gz: 31fb804f2d87c2b3db049eb24eb2086bbaadc8a3850314060bc066fa87b078f9
3
+ metadata.gz: 791562c871b9c8d9680778bf68bdde22c5911ad147bd28634f3051d2c3b5bf6a
4
+ data.tar.gz: e2782de74edb9609634ef022f9d94d98591d3e49c38cb5d667af407ffa87b5da
5
5
  SHA512:
6
- metadata.gz: 21126d00b18029300b5d49d32d4534071453d1dfb76e51fbc86d311e47779e606885fe792ca3bc58aab98bafe8dc3e4153cefce5f9bdb41db47755fba00ed44f
7
- data.tar.gz: f510878992373c898082dfd6291bf6fb4d1b8d096095d08ec2a2550ca99f3b0bcc22b53d230f314e05a3e3fed17e8caf3fea9cc49f5fa682b6c39d44ece876db
6
+ metadata.gz: f3569183ea0e3cc00895c2fa3760b280dd1244f7c69144e661c7fbbdc575f57c67b479b5f0074a6cbf13c93d25bb6e9bd1c89df443388187f8f6472ba00ddfd8
7
+ data.tar.gz: d856e272adb85fa91aca6d83fd3a5d1c4ae4e1e40f2cb318d9e369ed86c14df973c942c74a4c84e76c83f270eaaadc47021571852e1e39ef750927a3c5930f07
data/HISTORY CHANGED
@@ -1,5 +1,42 @@
1
1
  = Release History
2
2
 
3
+ == 4.1.1 / 2023-05-01
4
+
5
+ * Fix compile warning (or error) for input_callbacks_register_input_callbacks (Charlie Savage)
6
+ * Remove call to deprecated function htmlDefaultSAXHandlerInit (Charlie Savage)
7
+
8
+ == 4.1.0 / 2023-04-30
9
+
10
+ * Fix compile warning (or error) for rxml_encoding_to_rb_encoding (Charlie Savage)
11
+ * Breaking - Remove LibXML::XML.features since its uses functionality deprecated in LibXML (Charlie Savage)
12
+
13
+ == 4.0.0 / 2022-12-28
14
+
15
+ * Breaking - Remove support for XPointer since libxml2 has deprecated it and will remove it (Charlie Savage)
16
+ * Breaking - Remove support for ancient setup.rb script (Charlie Savage)
17
+
18
+ == 3.2.4 / 2022-10-29
19
+
20
+ * Support libxml2 version 2.10.2 (Charlie Savage)
21
+ * Reduce number of globally included C header files (Charlie Savage)
22
+
23
+ == 3.2.3 / 2022-05-22
24
+
25
+ * Change some getter methods to instance variables with attr_accessors for easier debuggability (David Hansen)
26
+ * Add a number of tests related to schemas (David Hansen)
27
+ * Add schema.imported_elements so we can find imported elements (David Hansen)
28
+ * Fix segfault under windows when dereferencing a pre-existing error where the node has already been freed (David Hansen)
29
+ * Update to change name from imported_elements to imported_ns_elements and return a hash of hashes for namespaced elements (David Hansen)
30
+ * Only call xmlGetFeaturesList if LIBXML_LEGACY_ENABLED is defined. Most distros still ship libxml2 with legacy features enabled, but this will change (Nick Wellnhofer)
31
+ * Update GitHub Actions to use ruby/setup-ruby (Greg)
32
+ * Fix memory leak in rxml_node_path, node.path (vovanmozg)
33
+
34
+ == 3.2.2 / 2022-01-15
35
+ * Switch to Github actions for CI/CD (Greg)
36
+ * Test fixes (Greg, Sergio Durigan Junior)
37
+ * Fix typo on test/test_sax_parser.rb (Sergio Durigan Junior)
38
+ * Update homepage in gemspec (Pirate Praveen Arimbrathodiyil)
39
+
3
40
  == 3.2.1 / 2020-11-05
4
41
 
5
42
  * Fix incorrect handling of encodings when using XMLWriter.io (Charlie Savage)
data/Rakefile CHANGED
@@ -16,21 +16,29 @@ spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
16
16
  task :default => [:test]
17
17
 
18
18
  # Setup compile tasks
19
- if RUBY_PLATFORM.match(/mswin32|mswin64|mingw32/)
20
- Rake::ExtensionTask.new do |ext|
21
- ext.gem_spec = spec
22
- ext.name = SO_NAME
23
- ext.ext_dir = "ext/libxml"
24
- ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
25
- ext.config_options << "--with-xml2-include=C:/msys64/mingw64/include/libxml2"
26
- end
27
- else
28
- Rake::ExtensionTask.new do |ext|
29
- ext.gem_spec = spec
30
- ext.name = SO_NAME
31
- ext.ext_dir = "ext/libxml"
32
- ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
33
- ext.config_options << "--with-xml2-include=/usr/include/libxml2"
19
+ Rake::ExtensionTask.new do |ext|
20
+ ext.gem_spec = spec
21
+ ext.name = SO_NAME
22
+ ext.ext_dir = "ext/libxml"
23
+ ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
24
+ if RUBY_PLATFORM.match(/mswin|mingw/)
25
+ ext.config_options <<
26
+ if (dir = ENV['WINDOWS_XML2_INCLUDE'])
27
+ "--with-xml2-include=#{dir}"
28
+ else
29
+ case RUBY_PLATFORM
30
+ when 'i386-mingw32'
31
+ '--with-xml2-include=C:/msys64/mingw32/include/libxml2'
32
+ when 'x64-mingw32'
33
+ '--with-xml2-include=C:/msys64/mingw64/include/libxml2'
34
+ when 'x64-mingw-ucrt'
35
+ '--with-xml2-include=C:/msys64/ucrt64/include/libxml2'
36
+ else
37
+ raise "Unknown Windows Ruby, please set ENV['WINDOWS_XML2_INCLUDE']"
38
+ end
39
+ end
40
+ else
41
+ ext.config_options << '--with-xml2-include=/usr/include/libxml2'
34
42
  end
35
43
  end
36
44
 
@@ -41,7 +49,7 @@ Gem::PackageTask.new(spec) do |pkg|
41
49
  end
42
50
 
43
51
  # Setup Windows Gem
44
- if RUBY_PLATFORM.match(/mswin32|mswin64|mingw32/)
52
+ if RUBY_PLATFORM.match(/mswin|mingw/)
45
53
  binaries = (FileList['lib/**/*.so',
46
54
  'lib/**/*dll'])
47
55
 
data/ext/libxml/libxml.c CHANGED
@@ -67,7 +67,6 @@ void Init_libxml_ruby(void)
67
67
  rxml_init_xpath_object();
68
68
  rxml_init_xpath_context();
69
69
  rxml_init_xpath_expression();
70
- rxml_init_xpointer();
71
70
  rxml_init_html_parser();
72
71
  rxml_init_html_parser_options();
73
72
  rxml_init_html_parser_context();
@@ -25,7 +25,6 @@ cXMLXInclude DATA
25
25
  cXMLXPathContext DATA
26
26
  cXMLXPathExpression DATA
27
27
  cXMLXPathObject DATA
28
- cXMLXPointer DATA
29
28
  eXMLError DATA
30
29
  mLibXML DATA
31
30
  mXML DATA
@@ -4,29 +4,7 @@
4
4
  #define __RUBY_LIBXML_H__
5
5
 
6
6
  #include <ruby.h>
7
- #include <libxml/parser.h>
8
- #include <libxml/parserInternals.h>
9
- #include <libxml/debugXML.h>
10
7
  #include <libxml/xmlversion.h>
11
- #include <libxml/xmlmemory.h>
12
- #include <libxml/xpath.h>
13
- #include <libxml/valid.h>
14
- #include <libxml/catalog.h>
15
- #include <libxml/HTMLparser.h>
16
- #include <libxml/xmlreader.h>
17
- #include <libxml/c14n.h>
18
-
19
- #include <ruby/encoding.h>
20
-
21
- #ifdef LIBXML_DEBUG_ENABLED
22
- #include <libxml/xpathInternals.h>
23
- #endif
24
- #ifdef LIBXML_XINCLUDE_ENABLED
25
- #include <libxml/xinclude.h>
26
- #endif
27
- #ifdef LIBXML_XPTR_ENABLED
28
- #include <libxml/xpointer.h>
29
- #endif
30
8
 
31
9
  #include "ruby_xml_version.h"
32
10
  #include "ruby_xml.h"
@@ -56,7 +34,6 @@
56
34
  #include "ruby_xml_xpath_expression.h"
57
35
  #include "ruby_xml_xpath_context.h"
58
36
  #include "ruby_xml_xpath_object.h"
59
- #include "ruby_xml_xpointer.h"
60
37
  #include "ruby_xml_input_cbg.h"
61
38
  #include "ruby_xml_dtd.h"
62
39
  #include "ruby_xml_schema.h"
@@ -1,6 +1,8 @@
1
1
  #include "ruby_libxml.h"
2
2
  #include "ruby_xml.h"
3
3
 
4
+ #include <libxml/catalog.h>
5
+
4
6
  VALUE mXML;
5
7
 
6
8
  /*
@@ -477,7 +479,7 @@ static VALUE rxml_default_line_numbers_set(VALUE klass, VALUE value)
477
479
  }
478
480
  }
479
481
 
480
- int rxml_libxml_default_options()
482
+ int rxml_libxml_default_options(void)
481
483
  {
482
484
  int options = 0;
483
485
 
@@ -755,41 +757,6 @@ static VALUE rxml_default_save_no_empty_tags_set(VALUE klass, VALUE value)
755
757
  }
756
758
  }
757
759
 
758
- /*
759
- * call-seq:
760
- * XML.features -> ["feature", ..., "feature"]
761
- *
762
- * Obtains an array of strings representing features supported
763
- * (and enabled) by the installed libxml.
764
- */
765
- static VALUE rxml_features(VALUE klass)
766
- {
767
- VALUE arr, str;
768
- int i, len = MAX_LIBXML_FEATURES_LEN;
769
- char **list = NULL;
770
-
771
- list = ALLOC_N(char *,MAX_LIBXML_FEATURES_LEN);
772
- MEMZERO(list, char *, MAX_LIBXML_FEATURES_LEN);
773
-
774
- arr = rb_ary_new();
775
- if (xmlGetFeaturesList(&len, (const char **) list) == -1)
776
- return Qnil;
777
-
778
- for (i = 0; i < len; i++)
779
- {
780
- str = rb_str_new2((const char *) list[i]);
781
- rb_gc_unregister_address(&str);
782
- rb_ary_push(arr, str);
783
- }
784
-
785
- if (len == MAX_LIBXML_FEATURES_LEN)
786
- rb_warn(
787
- "Please contact libxml-devel@rubyforge.org and ask to have the \"MAX_LIBXML_FEATURES_LEN increased\" because you could possibly be seeing an incomplete list");
788
-
789
- ruby_xfree(list);
790
- return (arr);
791
- }
792
-
793
760
  /*
794
761
  * call-seq:
795
762
  * XML.indent_tree_output -> (true|false)
@@ -925,7 +892,6 @@ void rxml_init_xml(void)
925
892
  rb_define_module_function(mXML, "default_warnings=", rxml_default_warnings_set, 1);
926
893
  rb_define_module_function(mXML, "default_save_no_empty_tags", rxml_default_save_no_empty_tags_get, 0);
927
894
  rb_define_module_function(mXML, "default_save_no_empty_tags=", rxml_default_save_no_empty_tags_set, 1);
928
- rb_define_module_function(mXML, "features", rxml_features, 0);
929
895
  rb_define_module_function(mXML, "indent_tree_output", rxml_indent_tree_output_get, 0);
930
896
  rb_define_module_function(mXML, "indent_tree_output=", rxml_indent_tree_output_set, 1);
931
897
  rb_define_module_function(mXML, "memory_dump", rxml_memory_dump, 0);
@@ -4,7 +4,7 @@
4
4
  #define __RUBY_XML_H__
5
5
 
6
6
  extern VALUE mXML;
7
- int rxml_libxml_default_options();
7
+ int rxml_libxml_default_options(void);
8
8
  void rxml_init_xml(void);
9
9
 
10
10
  #endif
@@ -79,7 +79,7 @@ int deb_Close(void *context)
79
79
  return 1;
80
80
  }
81
81
 
82
- void deb_register_cbg()
82
+ void deb_register_cbg(void)
83
83
  {
84
84
  xmlRegisterInputCallbacks(deb_Match, deb_Open, deb_Read, deb_Close);
85
85
  }
@@ -52,6 +52,12 @@
52
52
  #include "ruby_libxml.h"
53
53
  #include "ruby_xml_document.h"
54
54
 
55
+ #include <libxml/c14n.h>
56
+ #include <libxml/debugXML.h>
57
+ #include <libxml/relaxng.h>
58
+ #include <libxml/xmlschemas.h>
59
+ #include <libxml/xinclude.h>
60
+
55
61
  VALUE cXMLDocument;
56
62
 
57
63
  void rxml_document_free(xmlDocPtr xdoc)
@@ -235,7 +235,7 @@ static VALUE rxml_dtd_initialize(int argc, VALUE *argv, VALUE self)
235
235
  return self;
236
236
  }
237
237
 
238
- void rxml_init_dtd()
238
+ void rxml_init_dtd(void)
239
239
  {
240
240
  cXMLDtd = rb_define_class_under(mXML, "Dtd", rb_cObject);
241
241
  rb_define_alloc_func(cXMLDtd, rxml_dtd_alloc);
@@ -182,7 +182,7 @@ rb_encoding* rxml_figure_encoding(const xmlChar* xencoding)
182
182
  VALUE rxml_new_cstr(const xmlChar* xstr, const xmlChar* xencoding)
183
183
  {
184
184
  rb_encoding *rbencoding = rxml_figure_encoding(xencoding);
185
- return rb_external_str_new_with_enc((const char*)xstr, strlen((const char*)xstr), rbencoding);
185
+ return rb_external_str_new_with_enc((const char*)xstr, (long)strlen((const char*)xstr), rbencoding);
186
186
  }
187
187
 
188
188
  VALUE rxml_new_cstr_len(const xmlChar* xstr, const long length, const xmlChar* xencoding)
@@ -197,7 +197,7 @@ void rxml_init_encoding(void)
197
197
  rb_define_module_function(mXMLEncoding, "from_s", rxml_encoding_from_s, 1);
198
198
  rb_define_module_function(mXMLEncoding, "to_s", rxml_encoding_to_s, 1);
199
199
 
200
- rb_define_module_function(mXMLEncoding, "to_rb_encoding", rxml_encoding_to_rb_encoding, 2);
200
+ rb_define_module_function(mXMLEncoding, "to_rb_encoding", rxml_encoding_to_rb_encoding, 1);
201
201
 
202
202
  /* -1: No char encoding detected. */
203
203
  rb_define_const(mXMLEncoding, "ERROR", INT2NUM(XML_CHAR_ENCODING_ERROR));
@@ -3,6 +3,8 @@
3
3
  #ifndef __RXML_ENCODING__
4
4
  #define __RXML_ENCODING__
5
5
 
6
+ #include <ruby/encoding.h>
7
+
6
8
  extern VALUE mXMLEncoding;
7
9
 
8
10
  void rxml_init_encoding();
@@ -44,7 +44,7 @@ static ID ERROR_HANDLER_ID;
44
44
  * Returns the proc that will be called when libxml generates
45
45
  * warning, error or fatal error messages.
46
46
  */
47
- static VALUE rxml_error_get_handler()
47
+ static VALUE rxml_error_get_handler(VALUE self)
48
48
  {
49
49
  VALUE block = rb_cvar_get(eXMLError, ERROR_HANDLER_ID);
50
50
  return block;
@@ -102,7 +102,7 @@ static void structuredErrorFunc(void *userData, xmlErrorPtr xerror)
102
102
  VALUE error = rxml_error_wrap(xerror);
103
103
 
104
104
  /* Wrap error up as Ruby object and send it off to ruby */
105
- VALUE block = rxml_error_get_handler();
105
+ VALUE block = rxml_error_get_handler(error);
106
106
 
107
107
  /* Now call global handler */
108
108
  if (block != Qnil)
@@ -165,7 +165,7 @@ NORETURN(void rxml_raise(xmlErrorPtr xerror))
165
165
  rb_exc_raise(error);
166
166
  }
167
167
 
168
- void rxml_init_error()
168
+ void rxml_init_error(void)
169
169
  {
170
170
  CALL_METHOD = rb_intern("call");
171
171
  ERROR_HANDLER_ID = rb_intern("@@__error_handler_callback__");
@@ -3,9 +3,11 @@
3
3
  #ifndef __RXML_ERROR__
4
4
  #define __RXML_ERROR__
5
5
 
6
+ #include <libxml/xmlerror.h>
7
+
6
8
  extern VALUE eXMLError;
7
9
 
8
- void rxml_init_error();
10
+ void rxml_init_error(void);
9
11
  VALUE rxml_error_wrap(xmlErrorPtr xerror);
10
12
  NORETURN(void rxml_raise(xmlErrorPtr xerror));
11
13
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  #include "ruby_libxml.h"
4
4
 
5
+ #include <libxml/HTMLparser.h>
6
+
5
7
  /* Document-class: LibXML::XML::HTMLParser
6
8
  *
7
9
  * The HTML parser implements an HTML 4.0 non-verifying parser with an API
@@ -3,6 +3,7 @@
3
3
  #include "ruby_libxml.h"
4
4
  #include "ruby_xml_html_parser_context.h"
5
5
 
6
+ #include <libxml/parserInternals.h>
6
7
 
7
8
  /*
8
9
  * Document-class: LibXML::XML::HTMLParser::Context
@@ -242,7 +243,6 @@ static VALUE rxml_html_parser_context_string(VALUE klass, VALUE string)
242
243
  sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */
243
244
  htmlCtxtUseOptions(ctxt, rxml_libxml_default_options());
244
245
 
245
- htmlDefaultSAXHandlerInit();
246
246
  if (ctxt->sax != NULL)
247
247
  memcpy(ctxt->sax, &htmlDefaultSAXHandler, sizeof(xmlSAXHandlerV1));
248
248
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  #include "ruby_libxml.h"
4
4
 
5
+ #include <libxml/HTMLparser.h>
6
+
5
7
  /* Document-class: LibXML::XML::HTMLParser::Options
6
8
  *
7
9
  * Options to control the operation of the HTMLParser. The easiest
@@ -88,7 +88,7 @@ int ic_close(void *context)
88
88
  *
89
89
  * Register a new set of I/O callback for handling parser input.
90
90
  */
91
- static VALUE input_callbacks_register_input_callbacks()
91
+ static VALUE input_callbacks_register_input_callbacks(VALUE self)
92
92
  {
93
93
  xmlRegisterInputCallbacks(ic_match, ic_open, ic_read, ic_close);
94
94
  return (Qtrue);
@@ -182,10 +182,7 @@ void rxml_init_input_callbacks(void)
182
182
  cInputCallbacks = rb_define_class_under(mXML, "InputCallbacks", rb_cObject);
183
183
 
184
184
  /* Class Methods */
185
- rb_define_singleton_method(cInputCallbacks, "register",
186
- input_callbacks_register_input_callbacks, 0);
187
- rb_define_singleton_method(cInputCallbacks, "add_scheme",
188
- input_callbacks_add_scheme, 2);
189
- rb_define_singleton_method(cInputCallbacks, "remove_scheme",
190
- input_callbacks_remove_scheme, 1);
185
+ rb_define_singleton_method(cInputCallbacks, "register", input_callbacks_register_input_callbacks, 0);
186
+ rb_define_singleton_method(cInputCallbacks, "add_scheme", input_callbacks_add_scheme, 2);
187
+ rb_define_singleton_method(cInputCallbacks, "remove_scheme", input_callbacks_remove_scheme, 1);
191
188
  }
@@ -30,7 +30,7 @@ int rxml_write_callback(VALUE io, const char *buffer, int len)
30
30
  {
31
31
  // Could be StringIO
32
32
  VALUE written, string;
33
- string = rb_external_str_new_with_enc(buffer, strlen(buffer), rb_enc_get(io));
33
+ string = rb_external_str_new_with_enc(buffer, (long)strlen(buffer), rb_enc_get(io));
34
34
  written = rb_funcall(io, WRITE_METHOD, 1, string);
35
35
  return NUM2INT(written);
36
36
  }
@@ -52,6 +52,7 @@ static VALUE rxml_namespace_initialize(VALUE self, VALUE node, VALUE prefix,
52
52
 
53
53
  Check_Type(node, T_DATA);
54
54
  Data_Get_Struct(node, xmlNode, xnode);
55
+ xmlResetLastError();
55
56
 
56
57
  /* Prefix can be null - that means its the default namespace */
57
58
  xmlPrefix = NIL_P(prefix) ? NULL : (xmlChar *)StringValuePtr(prefix);
@@ -2,6 +2,10 @@
2
2
  #include "ruby_xml_node.h"
3
3
  #include <assert.h>
4
4
 
5
+ #include <libxml/debugXML.h>
6
+ #include <libxml/parserInternals.h>
7
+ #include <libxml/xlink.h>
8
+
5
9
  VALUE cXMLNode;
6
10
 
7
11
  /* Document-class: LibXML::XML::Node
@@ -983,25 +987,18 @@ static VALUE rxml_node_path(VALUE self)
983
987
  {
984
988
  xmlNodePtr xnode;
985
989
  xmlChar *path;
990
+ VALUE result = Qnil;
986
991
 
987
992
  xnode = rxml_get_xnode(self);
988
993
  path = xmlGetNodePath(xnode);
989
994
 
990
- if (path == NULL)
991
- return (Qnil);
992
- else
993
- return (rxml_new_cstr( path, NULL));
994
- }
995
+ if (path)
996
+ {
997
+ result = rxml_new_cstr( path, NULL);
998
+ xmlFree(path);
999
+ }
995
1000
 
996
- /*
997
- * call-seq:
998
- * node.pointer -> XML::NodeSet
999
- *
1000
- * Evaluates an XPointer expression relative to this node.
1001
- */
1002
- static VALUE rxml_node_pointer(VALUE self, VALUE xptr_str)
1003
- {
1004
- return (rxml_xpointer_point2(self, xptr_str));
1001
+ return result;
1005
1002
  }
1006
1003
 
1007
1004
  /*
@@ -1389,7 +1386,6 @@ void rxml_init_node(void)
1389
1386
  rb_define_method(cXMLNode, "output_escaping?", rxml_node_output_escaping_q, 0);
1390
1387
  rb_define_method(cXMLNode, "output_escaping=", rxml_node_output_escaping_set, 1);
1391
1388
  rb_define_method(cXMLNode, "path", rxml_node_path, 0);
1392
- rb_define_method(cXMLNode, "pointer", rxml_node_pointer, 1);
1393
1389
  rb_define_method(cXMLNode, "remove!", rxml_node_remove_ex, 0);
1394
1390
  rb_define_method(cXMLNode, "space_preserve", rxml_node_space_preserve_get, 0);
1395
1391
  rb_define_method(cXMLNode, "space_preserve=", rxml_node_space_preserve_set, 1);
@@ -3,8 +3,6 @@
3
3
  #ifndef __RXML_PARSER__
4
4
  #define __RXML_PARSER__
5
5
 
6
- #define MAX_LIBXML_FEATURES_LEN 50
7
-
8
6
  extern VALUE cXMLParser;
9
7
 
10
8
  void rxml_init_parser();
@@ -3,6 +3,8 @@
3
3
  #include "ruby_libxml.h"
4
4
  #include "ruby_xml_parser_context.h"
5
5
 
6
+ #include <libxml/parserInternals.h>
7
+
6
8
  VALUE cXMLParserContext;
7
9
  static ID IO_ATTR;
8
10
 
@@ -3,8 +3,6 @@
3
3
  #ifndef __RXML_PARSER_OPTIONS__
4
4
  #define __RXML_PARSER_OPTIONS__
5
5
 
6
- #define MAX_LIBXML_FEATURES_LEN 50
7
-
8
6
  extern VALUE mXMLParserOptions;
9
7
 
10
8
  void rxml_init_parser_options();
@@ -4,6 +4,9 @@
4
4
  #include "ruby_libxml.h"
5
5
  #include "ruby_xml_reader.h"
6
6
 
7
+ #include <libxml/xmlreader.h>
8
+ #include <libxml/xmlschemas.h>
9
+
7
10
  /*
8
11
  * Document-class: LibXML::XML::Reader
9
12
  *
@@ -4,9 +4,6 @@
4
4
  #ifndef __RXML_READER__
5
5
  #define __RXML_READER__
6
6
 
7
- #include <libxml/xmlreader.h>
8
- #include <libxml/xmlschemas.h>
9
-
10
7
  extern VALUE cXMLReader;
11
8
 
12
9
  void rxml_init_reader(void);
@@ -1,6 +1,8 @@
1
1
  #include "ruby_libxml.h"
2
2
  #include "ruby_xml_relaxng.h"
3
3
 
4
+ #include <libxml/relaxng.h>
5
+
4
6
  /*
5
7
  * Document-class: LibXML::XML::RelaxNG
6
8
  *
@@ -1,8 +1,6 @@
1
1
  #ifndef __RXML_RELAXNG__
2
2
  #define __RXML_RELAXNG__
3
3
 
4
- #include <libxml/relaxng.h>
5
-
6
4
  extern VALUE cXMLRelaxNG;
7
5
 
8
6
  void rxml_init_relaxng(void);