libxml-ruby 4.1.1-x64-mingw-ucrt → 5.0.0-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY +22 -0
  3. data/ext/libxml/extconf.rb +67 -61
  4. data/ext/libxml/ruby_libxml.h +43 -44
  5. data/ext/libxml/ruby_xml.c +0 -343
  6. data/ext/libxml/ruby_xml.h +9 -10
  7. data/ext/libxml/ruby_xml_attr_decl.c +154 -153
  8. data/ext/libxml/ruby_xml_attributes.c +276 -275
  9. data/ext/libxml/ruby_xml_attributes.h +2 -0
  10. data/ext/libxml/ruby_xml_document.c +6 -6
  11. data/ext/libxml/ruby_xml_document.h +11 -11
  12. data/ext/libxml/ruby_xml_dtd.c +3 -3
  13. data/ext/libxml/ruby_xml_encoding.h +20 -18
  14. data/ext/libxml/ruby_xml_error.c +9 -6
  15. data/ext/libxml/ruby_xml_error.h +2 -2
  16. data/ext/libxml/ruby_xml_html_parser_context.c +35 -21
  17. data/ext/libxml/ruby_xml_namespace.c +0 -3
  18. data/ext/libxml/ruby_xml_node.c +1394 -1398
  19. data/ext/libxml/ruby_xml_parser.h +1 -1
  20. data/ext/libxml/ruby_xml_parser_context.c +47 -39
  21. data/ext/libxml/ruby_xml_parser_options.c +9 -1
  22. data/ext/libxml/ruby_xml_parser_options.h +1 -1
  23. data/ext/libxml/ruby_xml_reader.c +1244 -1242
  24. data/ext/libxml/ruby_xml_relaxng.c +113 -112
  25. data/ext/libxml/ruby_xml_sax2_handler.c +1 -1
  26. data/ext/libxml/ruby_xml_sax_parser.c +1 -9
  27. data/ext/libxml/ruby_xml_schema.c +422 -420
  28. data/ext/libxml/ruby_xml_schema_attribute.c +108 -107
  29. data/ext/libxml/ruby_xml_schema_element.c +70 -69
  30. data/ext/libxml/ruby_xml_schema_type.c +252 -251
  31. data/ext/libxml/ruby_xml_version.h +5 -5
  32. data/ext/libxml/ruby_xml_writer.c +1138 -1137
  33. data/ext/libxml/ruby_xml_xpath.c +1 -1
  34. data/ext/libxml/ruby_xml_xpath_context.c +2 -2
  35. data/ext/libxml/ruby_xml_xpath_expression.c +81 -81
  36. data/ext/libxml/ruby_xml_xpath_object.c +340 -339
  37. data/lib/3.2/libxml_ruby.so +0 -0
  38. data/lib/3.3/libxml_ruby.so +0 -0
  39. data/lib/libxml/document.rb +13 -13
  40. data/lib/libxml/html_parser.rb +23 -23
  41. data/lib/libxml/parser.rb +26 -24
  42. data/lib/libxml/schema/element.rb +27 -19
  43. data/test/test.rb +5 -0
  44. data/test/test_document_write.rb +1 -4
  45. data/test/test_dtd.rb +1 -4
  46. data/test/test_encoding.rb +1 -4
  47. data/test/test_helper.rb +9 -2
  48. data/test/test_html_parser.rb +162 -162
  49. data/test/test_namespace.rb +1 -3
  50. data/test/test_node.rb +1 -3
  51. data/test/test_node_write.rb +1 -4
  52. data/test/test_parser.rb +26 -17
  53. data/test/test_reader.rb +4 -4
  54. data/test/test_sax_parser.rb +1 -1
  55. data/test/test_schema.rb +237 -231
  56. data/test/test_xml.rb +0 -99
  57. metadata +5 -4
  58. data/lib/3.1/libxml_ruby.so +0 -0
@@ -1,112 +1,113 @@
1
- #include "ruby_libxml.h"
2
- #include "ruby_xml_relaxng.h"
3
-
4
- #include <libxml/relaxng.h>
5
-
6
- /*
7
- * Document-class: LibXML::XML::RelaxNG
8
- *
9
- * The XML::RelaxNG class is used to prepare RelaxNG schemas for validation
10
- * of xml documents.
11
- *
12
- * Schemas can be created from XML documents, strings or URIs using the
13
- * corresponding methods (new for URIs).
14
- *
15
- * Once a schema is prepared, an XML document can be validated by the
16
- * XML::Document#validate_relaxng method providing the XML::RelaxNG object
17
- * as parameter. The method will raise an exception if the document is
18
- * not valid.
19
- *
20
- * Basic Usage:
21
- *
22
- * # parse schema as xml document
23
- * relaxng_document = XML::Document.file('schema.rng')
24
- *
25
- * # prepare schema for validation
26
- * relaxng_schema = XML::RelaxNG.document(relaxng_document)
27
- *
28
- * # parse xml document to be validated
29
- * instance = XML::Document.file('instance.xml')
30
- *
31
- * # validate
32
- * instance.validate_relaxng(relaxng_schema)
33
- */
34
-
35
- VALUE cXMLRelaxNG;
36
-
37
- static void rxml_relaxng_free(xmlRelaxNGPtr xrelaxng)
38
- {
39
- xmlRelaxNGFree(xrelaxng);
40
- }
41
-
42
- /*
43
- * call-seq:
44
- * XML::Relaxng.new(relaxng_uri) -> relaxng
45
- *
46
- * Create a new relaxng from the specified URI.
47
- */
48
- static VALUE rxml_relaxng_init_from_uri(VALUE class, VALUE uri)
49
- {
50
- xmlRelaxNGParserCtxtPtr xparser;
51
- xmlRelaxNGPtr xrelaxng;
52
-
53
- Check_Type(uri, T_STRING);
54
-
55
- xparser = xmlRelaxNGNewParserCtxt(StringValuePtr(uri));
56
- xrelaxng = xmlRelaxNGParse(xparser);
57
- xmlRelaxNGFreeParserCtxt(xparser);
58
-
59
- return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
60
- }
61
-
62
- /*
63
- * call-seq:
64
- * XML::RelaxNG.document(document) -> relaxng
65
- *
66
- * Create a new relaxng from the specified document.
67
- */
68
- static VALUE rxml_relaxng_init_from_document(VALUE class, VALUE document)
69
- {
70
- xmlDocPtr xdoc;
71
- xmlRelaxNGPtr xrelaxng;
72
- xmlRelaxNGParserCtxtPtr xparser;
73
-
74
- Data_Get_Struct(document, xmlDoc, xdoc);
75
-
76
- xparser = xmlRelaxNGNewDocParserCtxt(xdoc);
77
- xrelaxng = xmlRelaxNGParse(xparser);
78
- xmlRelaxNGFreeParserCtxt(xparser);
79
-
80
- return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
81
- }
82
-
83
- /*
84
- * call-seq:
85
- * XML::RelaxNG.string("relaxng_data") -> "value"
86
- *
87
- * Create a new relaxng using the specified string.
88
- */
89
- static VALUE rxml_relaxng_init_from_string(VALUE self, VALUE relaxng_str)
90
- {
91
- xmlRelaxNGParserCtxtPtr xparser;
92
- xmlRelaxNGPtr xrelaxng;
93
-
94
- Check_Type(relaxng_str, T_STRING);
95
-
96
- xparser = xmlRelaxNGNewMemParserCtxt(StringValuePtr(relaxng_str), (int)strlen(StringValuePtr(relaxng_str)));
97
- xrelaxng = xmlRelaxNGParse(xparser);
98
- xmlRelaxNGFreeParserCtxt(xparser);
99
-
100
- return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
101
- }
102
-
103
- void rxml_init_relaxng(void)
104
- {
105
- cXMLRelaxNG = rb_define_class_under(mXML, "RelaxNG", rb_cObject);
106
- rb_define_singleton_method(cXMLRelaxNG, "new", rxml_relaxng_init_from_uri, 1);
107
- rb_define_singleton_method(cXMLRelaxNG, "from_string",
108
- rxml_relaxng_init_from_string, 1);
109
- rb_define_singleton_method(cXMLRelaxNG, "document",
110
- rxml_relaxng_init_from_document, 1);
111
- }
112
-
1
+ #include "ruby_libxml.h"
2
+ #include "ruby_xml_relaxng.h"
3
+
4
+ #include <libxml/relaxng.h>
5
+
6
+ /*
7
+ * Document-class: LibXML::XML::RelaxNG
8
+ *
9
+ * The XML::RelaxNG class is used to prepare RelaxNG schemas for validation
10
+ * of xml documents.
11
+ *
12
+ * Schemas can be created from XML documents, strings or URIs using the
13
+ * corresponding methods (new for URIs).
14
+ *
15
+ * Once a schema is prepared, an XML document can be validated by the
16
+ * XML::Document#validate_relaxng method providing the XML::RelaxNG object
17
+ * as parameter. The method will raise an exception if the document is
18
+ * not valid.
19
+ *
20
+ * Basic Usage:
21
+ *
22
+ * # parse schema as xml document
23
+ * relaxng_document = XML::Document.file('schema.rng')
24
+ *
25
+ * # prepare schema for validation
26
+ * relaxng_schema = XML::RelaxNG.document(relaxng_document)
27
+ *
28
+ * # parse xml document to be validated
29
+ * instance = XML::Document.file('instance.xml')
30
+ *
31
+ * # validate
32
+ * instance.validate_relaxng(relaxng_schema)
33
+ */
34
+
35
+ VALUE cXMLRelaxNG;
36
+
37
+ static void rxml_relaxng_free(xmlRelaxNGPtr xrelaxng)
38
+ {
39
+ xmlRelaxNGFree(xrelaxng);
40
+ }
41
+
42
+ /*
43
+ * call-seq:
44
+ * XML::Relaxng.new(relaxng_uri) -> relaxng
45
+ *
46
+ * Create a new relaxng from the specified URI.
47
+ */
48
+ static VALUE rxml_relaxng_init_from_uri(VALUE class, VALUE uri)
49
+ {
50
+ xmlRelaxNGParserCtxtPtr xparser;
51
+ xmlRelaxNGPtr xrelaxng;
52
+
53
+ Check_Type(uri, T_STRING);
54
+
55
+ xparser = xmlRelaxNGNewParserCtxt(StringValuePtr(uri));
56
+ xrelaxng = xmlRelaxNGParse(xparser);
57
+ xmlRelaxNGFreeParserCtxt(xparser);
58
+
59
+ return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
60
+ }
61
+
62
+ /*
63
+ * call-seq:
64
+ * XML::RelaxNG.document(document) -> relaxng
65
+ *
66
+ * Create a new relaxng from the specified document.
67
+ */
68
+ static VALUE rxml_relaxng_init_from_document(VALUE class, VALUE document)
69
+ {
70
+ xmlDocPtr xdoc;
71
+ xmlRelaxNGPtr xrelaxng;
72
+ xmlRelaxNGParserCtxtPtr xparser;
73
+
74
+ Data_Get_Struct(document, xmlDoc, xdoc);
75
+
76
+ xparser = xmlRelaxNGNewDocParserCtxt(xdoc);
77
+ xrelaxng = xmlRelaxNGParse(xparser);
78
+ xmlRelaxNGFreeParserCtxt(xparser);
79
+
80
+ return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
81
+ }
82
+
83
+ /*
84
+ * call-seq:
85
+ * XML::RelaxNG.string("relaxng_data") -> "value"
86
+ *
87
+ * Create a new relaxng using the specified string.
88
+ */
89
+ static VALUE rxml_relaxng_init_from_string(VALUE self, VALUE relaxng_str)
90
+ {
91
+ xmlRelaxNGParserCtxtPtr xparser;
92
+ xmlRelaxNGPtr xrelaxng;
93
+
94
+ Check_Type(relaxng_str, T_STRING);
95
+
96
+ xparser = xmlRelaxNGNewMemParserCtxt(StringValuePtr(relaxng_str), (int)strlen(StringValuePtr(relaxng_str)));
97
+ xrelaxng = xmlRelaxNGParse(xparser);
98
+ xmlRelaxNGFreeParserCtxt(xparser);
99
+
100
+ return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
101
+ }
102
+
103
+ void rxml_init_relaxng(void)
104
+ {
105
+ cXMLRelaxNG = rb_define_class_under(mXML, "RelaxNG", rb_cObject);
106
+ rb_undef_alloc_func(cXMLRelaxNG);
107
+ rb_define_singleton_method(cXMLRelaxNG, "new", rxml_relaxng_init_from_uri, 1);
108
+ rb_define_singleton_method(cXMLRelaxNG, "from_string",
109
+ rxml_relaxng_init_from_string, 1);
110
+ rb_define_singleton_method(cXMLRelaxNG, "document",
111
+ rxml_relaxng_init_from_document, 1);
112
+ }
113
+
@@ -243,7 +243,7 @@ static void start_element_ns_callback(void *ctx,
243
243
  namespaces);
244
244
  }
245
245
 
246
- static void structured_error_callback(void *ctx, xmlErrorPtr xerror)
246
+ static void structured_error_callback(void *ctx, const xmlError *xerror)
247
247
  {
248
248
  /* Older versions of Libxml will pass a NULL context from the sax parser. Fixed on
249
249
  Feb 23, 2011. See:
@@ -74,23 +74,15 @@ static VALUE rxml_sax_parser_initialize(int argc, VALUE *argv, VALUE self)
74
74
  */
75
75
  static VALUE rxml_sax_parser_parse(VALUE self)
76
76
  {
77
- int status;
78
77
  VALUE context = rb_ivar_get(self, CONTEXT_ATTR);
79
78
  xmlParserCtxtPtr ctxt;
80
79
  Data_Get_Struct(context, xmlParserCtxt, ctxt);
81
80
 
82
81
  ctxt->sax2 = 1;
83
82
  ctxt->userData = (void*)rb_ivar_get(self, CALLBACKS_ATTR);
84
-
85
- if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
86
- xmlFree(ctxt->sax);
87
-
88
- ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(rxml_sax_handler));
89
- if (ctxt->sax == NULL)
90
- rb_fatal("Not enough memory.");
91
83
  memcpy(ctxt->sax, &rxml_sax_handler, sizeof(rxml_sax_handler));
92
84
 
93
- status = xmlParseDocument(ctxt);
85
+ int status = xmlParseDocument(ctxt);
94
86
 
95
87
  /* Now check the parsing result*/
96
88
  if (status == -1 || !ctxt->wellFormed)