libxml-ruby 5.0.5 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/{HISTORY → CHANGELOG.md} +875 -923
  3. data/LICENSE +20 -20
  4. data/README.md +67 -0
  5. data/Rakefile +77 -98
  6. data/ext/libxml/extconf.rb +34 -20
  7. data/ext/libxml/libxml.c +67 -79
  8. data/ext/libxml/ruby_libxml.h +1 -1
  9. data/ext/libxml/ruby_xml_attr.c +338 -333
  10. data/ext/libxml/ruby_xml_attr.h +13 -12
  11. data/ext/libxml/ruby_xml_attr_decl.c +19 -12
  12. data/ext/libxml/ruby_xml_attr_decl.h +11 -11
  13. data/ext/libxml/ruby_xml_attributes.c +18 -9
  14. data/ext/libxml/ruby_xml_document.c +111 -98
  15. data/ext/libxml/ruby_xml_document.h +1 -0
  16. data/ext/libxml/ruby_xml_dtd.c +49 -19
  17. data/ext/libxml/ruby_xml_dtd.h +10 -9
  18. data/ext/libxml/ruby_xml_html_parser.c +91 -91
  19. data/ext/libxml/ruby_xml_html_parser.h +10 -10
  20. data/ext/libxml/ruby_xml_html_parser_context.c +19 -6
  21. data/ext/libxml/ruby_xml_html_parser_context.h +11 -10
  22. data/ext/libxml/ruby_xml_html_parser_options.c +48 -48
  23. data/ext/libxml/ruby_xml_html_parser_options.h +10 -10
  24. data/ext/libxml/ruby_xml_input_cbg.c +45 -17
  25. data/ext/libxml/ruby_xml_input_cbg.h +20 -20
  26. data/ext/libxml/ruby_xml_io.c +49 -47
  27. data/ext/libxml/ruby_xml_io.h +10 -10
  28. data/ext/libxml/ruby_xml_namespace.c +20 -12
  29. data/ext/libxml/ruby_xml_namespace.h +11 -10
  30. data/ext/libxml/ruby_xml_namespaces.c +313 -293
  31. data/ext/libxml/ruby_xml_namespaces.h +9 -9
  32. data/ext/libxml/ruby_xml_node.c +71 -32
  33. data/ext/libxml/ruby_xml_node.h +15 -13
  34. data/ext/libxml/ruby_xml_parser.c +91 -91
  35. data/ext/libxml/ruby_xml_parser_context.c +54 -47
  36. data/ext/libxml/ruby_xml_parser_context.h +11 -10
  37. data/ext/libxml/ruby_xml_reader.c +25 -15
  38. data/ext/libxml/ruby_xml_reader.h +14 -14
  39. data/ext/libxml/ruby_xml_registry.c +31 -0
  40. data/ext/libxml/ruby_xml_registry.h +22 -0
  41. data/ext/libxml/ruby_xml_relaxng.c +21 -5
  42. data/ext/libxml/ruby_xml_relaxng.h +9 -8
  43. data/ext/libxml/ruby_xml_sax2_handler.h +10 -10
  44. data/ext/libxml/ruby_xml_sax_parser.c +1 -1
  45. data/ext/libxml/ruby_xml_sax_parser.h +10 -10
  46. data/ext/libxml/ruby_xml_schema.c +18 -11
  47. data/ext/libxml/ruby_xml_schema.h +26 -25
  48. data/ext/libxml/ruby_xml_schema_attribute.c +7 -7
  49. data/ext/libxml/ruby_xml_schema_attribute.h +37 -37
  50. data/ext/libxml/ruby_xml_schema_element.c +8 -8
  51. data/ext/libxml/ruby_xml_schema_element.h +11 -11
  52. data/ext/libxml/ruby_xml_schema_facet.c +50 -50
  53. data/ext/libxml/ruby_xml_schema_facet.h +9 -9
  54. data/ext/libxml/ruby_xml_schema_type.c +12 -19
  55. data/ext/libxml/ruby_xml_schema_type.h +9 -9
  56. data/ext/libxml/ruby_xml_version.h +4 -4
  57. data/ext/libxml/ruby_xml_writer.c +1136 -1124
  58. data/ext/libxml/ruby_xml_writer.h +6 -6
  59. data/ext/libxml/ruby_xml_xinclude.c +20 -20
  60. data/ext/libxml/ruby_xml_xinclude.h +11 -11
  61. data/ext/libxml/ruby_xml_xpath.c +195 -195
  62. data/ext/libxml/ruby_xml_xpath.h +15 -15
  63. data/ext/libxml/ruby_xml_xpath_context.c +408 -362
  64. data/ext/libxml/ruby_xml_xpath_context.h +9 -9
  65. data/ext/libxml/ruby_xml_xpath_expression.c +11 -5
  66. data/ext/libxml/ruby_xml_xpath_expression.h +11 -10
  67. data/ext/libxml/ruby_xml_xpath_object.c +69 -54
  68. data/ext/libxml/ruby_xml_xpath_object.h +19 -17
  69. data/ext/vc/libxml_ruby/libxml_ruby.vcxproj +271 -0
  70. data/ext/xcode/libxml-ruby.xcodeproj/project.pbxproj +633 -0
  71. data/ext/xcode/libxml-ruby.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  72. data/ext/xcode/libxml-ruby.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  73. data/ext/xcode/libxml-ruby.xcodeproj/xcshareddata/xcschemes/libxml-ruby.xcscheme +80 -0
  74. data/lib/libxml/document.rb +0 -29
  75. data/lib/libxml/error.rb +30 -3
  76. data/lib/libxml/html_parser.rb +0 -16
  77. data/lib/libxml/node.rb +1 -3
  78. data/lib/libxml/parser.rb +0 -8
  79. data/lib/libxml/schema/attribute.rb +27 -19
  80. data/lib/libxml/schema/element.rb +20 -0
  81. data/lib/libxml/schema/type.rb +44 -21
  82. data/lib/libxml/schema.rb +47 -47
  83. data/lib/libxml-ruby.rb +30 -30
  84. data/libxml-ruby.gemspec +12 -16
  85. data/test/c14n/result/1-1-without-comments/example-1 +3 -3
  86. data/test/c14n/result/1-1-without-comments/example-2 +10 -10
  87. data/test/c14n/result/1-1-without-comments/example-3 +13 -13
  88. data/test/c14n/result/1-1-without-comments/example-4 +8 -8
  89. data/test/c14n/result/1-1-without-comments/example-5 +2 -2
  90. data/test/c14n/result/with-comments/example-1 +5 -5
  91. data/test/c14n/result/with-comments/example-2 +10 -10
  92. data/test/c14n/result/with-comments/example-3 +13 -13
  93. data/test/c14n/result/with-comments/example-4 +8 -8
  94. data/test/c14n/result/with-comments/example-5 +3 -3
  95. data/test/c14n/result/without-comments/example-1 +3 -3
  96. data/test/c14n/result/without-comments/example-2 +10 -10
  97. data/test/c14n/result/without-comments/example-3 +13 -13
  98. data/test/c14n/result/without-comments/example-4 +8 -8
  99. data/test/c14n/result/without-comments/example-5 +2 -2
  100. data/test/test_attr.rb +179 -180
  101. data/test/test_attr_decl.rb +131 -131
  102. data/test/test_attributes.rb +135 -135
  103. data/test/test_canonicalize.rb +122 -120
  104. data/test/test_document.rb +2 -4
  105. data/test/test_dtd.rb +12 -4
  106. data/test/test_encoding_sax.rb +114 -114
  107. data/test/test_error.rb +6 -3
  108. data/test/test_helper.rb +1 -0
  109. data/test/test_html_parser.rb +6 -2
  110. data/test/test_html_parser_context.rb +22 -22
  111. data/test/test_input_callbacks.rb +36 -0
  112. data/test/test_namespace.rb +1 -1
  113. data/test/test_namespaces.rb +200 -200
  114. data/test/test_node.rb +16 -0
  115. data/test/test_node_cdata.rb +50 -50
  116. data/test/test_node_comment.rb +32 -32
  117. data/test/test_node_copy.rb +40 -40
  118. data/test/test_node_edit.rb +176 -158
  119. data/test/test_node_pi.rb +37 -37
  120. data/test/test_node_text.rb +69 -69
  121. data/test/test_node_xlink.rb +28 -28
  122. data/test/test_parser.rb +5 -41
  123. data/test/test_parser_context.rb +198 -198
  124. data/test/test_properties.rb +38 -38
  125. data/test/test_reader.rb +55 -6
  126. data/test/test_relaxng.rb +59 -53
  127. data/test/test_sax_parser.rb +345 -345
  128. data/test/test_schema.rb +28 -0
  129. data/test/test_traversal.rb +152 -152
  130. data/test/test_writer.rb +469 -468
  131. data/test/test_xinclude.rb +20 -20
  132. data/test/test_xml.rb +3 -7
  133. data/test/test_xpath.rb +244 -244
  134. data/test/test_xpath_context.rb +87 -87
  135. data/test/test_xpath_expression.rb +37 -37
  136. metadata +33 -27
  137. data/README.rdoc +0 -208
  138. data/ext/libxml/extconf.h +0 -3
  139. data/ext/libxml/ruby_xml_cbg.c +0 -85
  140. data/lib/libxml/hpricot.rb +0 -78
  141. data/lib/libxml.rb +0 -5
  142. data/lib/xml/libxml.rb +0 -10
  143. data/lib/xml.rb +0 -14
  144. data/script/benchmark/depixelate +0 -634
  145. data/script/benchmark/hamlet.xml +0 -9055
  146. data/script/benchmark/parsecount +0 -170
  147. data/script/benchmark/sock_entries.xml +0 -507
  148. data/script/benchmark/throughput +0 -41
  149. data/script/test +0 -6
  150. data/test/test.rb +0 -5
  151. data/test/test_deprecated_require.rb +0 -12
@@ -1,8 +1,9 @@
1
- #ifndef __RXML_RELAXNG__
2
- #define __RXML_RELAXNG__
3
-
4
- extern VALUE cXMLRelaxNG;
5
-
6
- void rxml_init_relaxng(void);
7
- #endif
8
-
1
+ #ifndef __RXML_RELAXNG__
2
+ #define __RXML_RELAXNG__
3
+
4
+ extern VALUE cXMLRelaxNG;
5
+ extern const rb_data_type_t rxml_relaxng_data_type;
6
+
7
+ void rxml_init_relaxng(void);
8
+ #endif
9
+
@@ -1,10 +1,10 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RXML_SAX2_HANDLER__
4
- #define __RXML_SAX2_HANDLER__
5
-
6
- extern xmlSAXHandler rxml_sax_handler;
7
-
8
- void rxml_init_sax2_handler(void);
9
-
10
- #endif
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #ifndef __RXML_SAX2_HANDLER__
4
+ #define __RXML_SAX2_HANDLER__
5
+
6
+ extern xmlSAXHandler rxml_sax_handler;
7
+
8
+ void rxml_init_sax2_handler(void);
9
+
10
+ #endif
@@ -76,7 +76,7 @@ static VALUE rxml_sax_parser_parse(VALUE self)
76
76
  {
77
77
  VALUE context = rb_ivar_get(self, CONTEXT_ATTR);
78
78
  xmlParserCtxtPtr ctxt;
79
- Data_Get_Struct(context, xmlParserCtxt, ctxt);
79
+ TypedData_Get_Struct(context, xmlParserCtxt, &rxml_parser_context_type, ctxt);
80
80
 
81
81
  ctxt->sax2 = 1;
82
82
  ctxt->userData = (void*)rb_ivar_get(self, CALLBACKS_ATTR);
@@ -1,10 +1,10 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RXML_SAX_PARSER__
4
- #define __RXML_SAX_PARSER__
5
-
6
- extern VALUE cXMLSaxParser;
7
-
8
- void rxml_init_sax_parser(void);
9
-
10
- #endif
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #ifndef __RXML_SAX_PARSER__
4
+ #define __RXML_SAX_PARSER__
5
+
6
+ extern VALUE cXMLSaxParser;
7
+
8
+ void rxml_init_sax_parser(void);
9
+
10
+ #endif
@@ -109,11 +109,18 @@ struct _xmlSchemaImport {
109
109
 
110
110
  VALUE cXMLSchema;
111
111
 
112
- static void rxml_schema_free(xmlSchemaPtr xschema)
112
+ static void rxml_schema_free(void *data)
113
113
  {
114
+ xmlSchemaPtr xschema = (xmlSchemaPtr)data;
114
115
  xmlSchemaFree(xschema);
115
116
  }
116
117
 
118
+ const rb_data_type_t rxml_schema_type = {
119
+ "XML::Schema",
120
+ {NULL, rxml_schema_free, NULL},
121
+ NULL, NULL, 0
122
+ };
123
+
117
124
  VALUE rxml_wrap_schema(xmlSchemaPtr xschema)
118
125
  {
119
126
  VALUE result;
@@ -121,7 +128,7 @@ VALUE rxml_wrap_schema(xmlSchemaPtr xschema)
121
128
  if (!xschema)
122
129
  rb_raise(rb_eArgError, "XML::Schema is required!");
123
130
 
124
- result = Data_Wrap_Struct(cXMLSchema, NULL, rxml_schema_free, xschema);
131
+ result = TypedData_Wrap_Struct(cXMLSchema, &rxml_schema_type, xschema);
125
132
 
126
133
  /*
127
134
  * Create these as instance variables to provide the output of inspect/to_str some
@@ -130,7 +137,7 @@ VALUE rxml_wrap_schema(xmlSchemaPtr xschema)
130
137
  rb_iv_set(result, "@target_namespace", QNIL_OR_STRING(xschema->targetNamespace));
131
138
  rb_iv_set(result, "@name", QNIL_OR_STRING(xschema->name));
132
139
  rb_iv_set(result, "@id", QNIL_OR_STRING(xschema->id));
133
- rb_iv_set(result, "@version", QNIL_OR_STRING(xschema->name));
140
+ rb_iv_set(result, "@version", QNIL_OR_STRING(xschema->version));
134
141
 
135
142
  return result;
136
143
  }
@@ -179,7 +186,7 @@ static VALUE rxml_schema_init_from_document(VALUE class, VALUE document)
179
186
  xmlDocPtr xdoc;
180
187
  xmlSchemaParserCtxtPtr xparser;
181
188
 
182
- Data_Get_Struct(document, xmlDoc, xdoc);
189
+ TypedData_Get_Struct(document, xmlDoc, &rxml_document_data_type, xdoc);
183
190
 
184
191
  xmlResetLastError();
185
192
  xparser = xmlSchemaNewDocParserCtxt(xdoc);
@@ -219,7 +226,7 @@ static VALUE rxml_schema_document(VALUE self)
219
226
  {
220
227
  xmlSchemaPtr xschema;
221
228
 
222
- Data_Get_Struct(self, xmlSchema, xschema);
229
+ TypedData_Get_Struct(self, xmlSchema, &rxml_schema_type, xschema);
223
230
 
224
231
  return rxml_node_wrap(xmlDocGetRootElement(xschema->doc));
225
232
  }
@@ -254,7 +261,7 @@ static VALUE rxml_schema_namespaces(VALUE self)
254
261
  VALUE result;
255
262
  xmlSchemaPtr xschema;
256
263
 
257
- Data_Get_Struct(self, xmlSchema, xschema);
264
+ TypedData_Get_Struct(self, xmlSchema, &rxml_schema_type, xschema);
258
265
 
259
266
  result = rb_ary_new();
260
267
  xmlHashScan(xschema->schemasImports, (xmlHashScanner)scan_namespaces, (void *)result);
@@ -273,7 +280,7 @@ static VALUE rxml_schema_elements(VALUE self)
273
280
  VALUE result = rb_hash_new();
274
281
  xmlSchemaPtr xschema;
275
282
 
276
- Data_Get_Struct(self, xmlSchema, xschema);
283
+ TypedData_Get_Struct(self, xmlSchema, &rxml_schema_type, xschema);
277
284
  xmlHashScan(xschema->elemDecl, (xmlHashScanner)scan_schema_element, (void *)result);
278
285
 
279
286
  return result;
@@ -300,7 +307,7 @@ static VALUE rxml_schema_imported_ns_elements(VALUE self)
300
307
  xmlSchemaPtr xschema;
301
308
  VALUE result = rb_hash_new();
302
309
 
303
- Data_Get_Struct(self, xmlSchema, xschema);
310
+ TypedData_Get_Struct(self, xmlSchema, &rxml_schema_type, xschema);
304
311
 
305
312
  if (xschema)
306
313
  {
@@ -321,7 +328,7 @@ static VALUE rxml_schema_types(VALUE self)
321
328
  VALUE result = rb_hash_new();
322
329
  xmlSchemaPtr xschema;
323
330
 
324
- Data_Get_Struct(self, xmlSchema, xschema);
331
+ TypedData_Get_Struct(self, xmlSchema, &rxml_schema_type, xschema);
325
332
 
326
333
  if (xschema != NULL && xschema->typeDecl != NULL)
327
334
  {
@@ -350,7 +357,7 @@ static VALUE rxml_schema_imported_types(VALUE self)
350
357
  xmlSchemaPtr xschema;
351
358
  VALUE result = rb_hash_new();
352
359
 
353
- Data_Get_Struct(self, xmlSchema, xschema);
360
+ TypedData_Get_Struct(self, xmlSchema, &rxml_schema_type, xschema);
354
361
 
355
362
  if (xschema)
356
363
  {
@@ -381,7 +388,7 @@ static VALUE rxml_schema_imported_ns_types(VALUE self)
381
388
  xmlSchemaPtr xschema;
382
389
  VALUE result = rb_hash_new();
383
390
 
384
- Data_Get_Struct(self, xmlSchema, xschema);
391
+ TypedData_Get_Struct(self, xmlSchema, &rxml_schema_type, xschema);
385
392
 
386
393
  if (xschema)
387
394
  {
@@ -1,25 +1,26 @@
1
- #ifndef __RXML_SCHEMA__
2
- #define __RXML_SCHEMA__
3
-
4
- #include <libxml/schemasInternals.h>
5
- #include <libxml/xmlschemastypes.h>
6
-
7
- typedef struct _xmlSchemaItemList xmlSchemaItemList;
8
- typedef xmlSchemaItemList *xmlSchemaItemListPtr;
9
- struct _xmlSchemaItemList {
10
- void **items;
11
- /* used for dynamic addition of schemata */
12
- int nbItems;
13
- /* used for dynamic addition of schemata */
14
- int sizeItems; /* used for dynamic addition of schemata */
15
- };
16
-
17
- #define QNIL_OR_STRING(slot) \
18
- (slot == NULL) ? Qnil : rb_str_new2((const char *)slot)
19
-
20
- extern VALUE cXMLSchema;
21
-
22
- void rxml_init_schema(void);
23
-
24
- #endif
25
-
1
+ #ifndef __RXML_SCHEMA__
2
+ #define __RXML_SCHEMA__
3
+
4
+ #include <libxml/schemasInternals.h>
5
+ #include <libxml/xmlschemastypes.h>
6
+
7
+ typedef struct _xmlSchemaItemList xmlSchemaItemList;
8
+ typedef xmlSchemaItemList *xmlSchemaItemListPtr;
9
+ struct _xmlSchemaItemList {
10
+ void **items;
11
+ /* used for dynamic addition of schemata */
12
+ int nbItems;
13
+ /* used for dynamic addition of schemata */
14
+ int sizeItems; /* used for dynamic addition of schemata */
15
+ };
16
+
17
+ #define QNIL_OR_STRING(slot) \
18
+ (slot == NULL) ? Qnil : rb_str_new2((const char *)slot)
19
+
20
+ extern VALUE cXMLSchema;
21
+ extern const rb_data_type_t rxml_schema_type;
22
+
23
+ void rxml_init_schema(void);
24
+
25
+ #endif
26
+
@@ -50,11 +50,11 @@ struct _xmlSchemaAttributeUseProhib {
50
50
 
51
51
  VALUE cXMLSchemaAttribute;
52
52
 
53
- static void rxml_schema_attribute_free(xmlSchemaAttributeUsePtr attr)
54
- {
55
- attr = NULL;
56
- xmlFree(attr);
57
- }
53
+ static const rb_data_type_t rxml_schema_attribute_type = {
54
+ "XML::Schema::Attribute",
55
+ {NULL, NULL, NULL},
56
+ NULL, NULL, 0
57
+ };
58
58
 
59
59
  VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr)
60
60
  {
@@ -64,7 +64,7 @@ VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr)
64
64
  if (!attr)
65
65
  rb_raise(rb_eArgError, "XML::Schema::Attribute required!");
66
66
 
67
- result = Data_Wrap_Struct(cXMLSchemaAttribute, NULL, rxml_schema_attribute_free, attr);
67
+ result = TypedData_Wrap_Struct(cXMLSchemaAttribute, &rxml_schema_attribute_type, attr);
68
68
 
69
69
  if (attr->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) {
70
70
  tns_str = ((xmlSchemaAttributeUseProhibPtr) attr)->targetNamespace;
@@ -89,7 +89,7 @@ static VALUE rxml_schema_attribute_node(VALUE self)
89
89
  {
90
90
  xmlSchemaAttributeUsePtr attr;
91
91
 
92
- Data_Get_Struct(self, xmlSchemaAttributeUse, attr);
92
+ TypedData_Get_Struct(self, xmlSchemaAttributeUse, &rxml_schema_attribute_type, attr);
93
93
 
94
94
  return rxml_node_wrap(attr->node);
95
95
  }
@@ -1,37 +1,37 @@
1
- #ifndef __RXML_SCHEMA_ATTRIBUTE__
2
- #define __RXML_SCHEMA_ATTRIBUTE__
3
-
4
- #include "ruby_xml_schema.h"
5
-
6
- extern VALUE cXMLSchemaAttribute;
7
-
8
- /**
9
- * xmlSchemaAttributeUsePtr:
10
- *
11
- * The abstract base type for tree-like structured schema components.
12
- * (Extends xmlSchemaTreeItem)
13
- */
14
- typedef struct _xmlSchemaAttributeUse xmlSchemaAttributeUse;
15
- typedef xmlSchemaAttributeUse *xmlSchemaAttributeUsePtr;
16
- struct _xmlSchemaAttributeUse {
17
- xmlSchemaTypeType type;
18
- xmlSchemaAnnotPtr annot;
19
- xmlSchemaAttributeUsePtr next; /* The next attr. use. */
20
- /*
21
- * The attr. decl. OR a QName-ref. to an attr. decl. OR
22
- * a QName-ref. to an attribute group definition.
23
- */
24
- xmlSchemaAttributePtr attrDecl;
25
-
26
- int flags;
27
- xmlNodePtr node;
28
- int occurs;
29
- /* required, optional */
30
- const xmlChar *defValue;
31
- xmlSchemaValPtr defVal;
32
- };
33
-
34
- void rxml_init_schema_attribute(void);
35
- VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr);
36
-
37
- #endif
1
+ #ifndef __RXML_SCHEMA_ATTRIBUTE__
2
+ #define __RXML_SCHEMA_ATTRIBUTE__
3
+
4
+ #include "ruby_xml_schema.h"
5
+
6
+ extern VALUE cXMLSchemaAttribute;
7
+
8
+ /**
9
+ * xmlSchemaAttributeUsePtr:
10
+ *
11
+ * The abstract base type for tree-like structured schema components.
12
+ * (Extends xmlSchemaTreeItem)
13
+ */
14
+ typedef struct _xmlSchemaAttributeUse xmlSchemaAttributeUse;
15
+ typedef xmlSchemaAttributeUse *xmlSchemaAttributeUsePtr;
16
+ struct _xmlSchemaAttributeUse {
17
+ xmlSchemaTypeType type;
18
+ xmlSchemaAnnotPtr annot;
19
+ xmlSchemaAttributeUsePtr next; /* The next attr. use. */
20
+ /*
21
+ * The attr. decl. OR a QName-ref. to an attr. decl. OR
22
+ * a QName-ref. to an attribute group definition.
23
+ */
24
+ xmlSchemaAttributePtr attrDecl;
25
+
26
+ int flags;
27
+ xmlNodePtr node;
28
+ int occurs;
29
+ /* required, optional */
30
+ const xmlChar *defValue;
31
+ xmlSchemaValPtr defVal;
32
+ };
33
+
34
+ void rxml_init_schema_attribute(void);
35
+ VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr);
36
+
37
+ #endif
@@ -4,11 +4,11 @@
4
4
 
5
5
  VALUE cXMLSchemaElement;
6
6
 
7
- static void rxml_schema_element_free(xmlSchemaElementPtr xschema_element)
8
- {
9
- xschema_element = NULL;
10
- xmlFree(xschema_element);
11
- }
7
+ static const rb_data_type_t rxml_schema_element_type = {
8
+ "XML::Schema::Element",
9
+ {NULL, NULL, NULL},
10
+ NULL, NULL, 0
11
+ };
12
12
 
13
13
  VALUE rxml_wrap_schema_element(xmlSchemaElementPtr xelem)
14
14
  {
@@ -17,7 +17,7 @@ VALUE rxml_wrap_schema_element(xmlSchemaElementPtr xelem)
17
17
  if (!xelem)
18
18
  rb_raise(rb_eArgError, "XML::Schema::Element is required!");
19
19
 
20
- result = Data_Wrap_Struct(cXMLSchemaElement, NULL, rxml_schema_element_free, xelem);
20
+ result = TypedData_Wrap_Struct(cXMLSchemaElement, &rxml_schema_element_type, xelem);
21
21
 
22
22
  rb_iv_set(result, "@name", QNIL_OR_STRING(xelem->name));
23
23
  rb_iv_set(result, "@value", QNIL_OR_STRING(xelem->value));
@@ -31,7 +31,7 @@ static VALUE rxml_schema_element_node(VALUE self)
31
31
  {
32
32
  xmlSchemaElementPtr xelem;
33
33
 
34
- Data_Get_Struct(self, xmlSchemaElement, xelem);
34
+ TypedData_Get_Struct(self, xmlSchemaElement, &rxml_schema_element_type, xelem);
35
35
 
36
36
  return rxml_node_wrap(xelem->node);
37
37
  }
@@ -41,7 +41,7 @@ static VALUE rxml_schema_element_annot(VALUE self)
41
41
  xmlSchemaElementPtr xelem;
42
42
  VALUE annotation = Qnil;
43
43
 
44
- Data_Get_Struct(self, xmlSchemaElement, xelem);
44
+ TypedData_Get_Struct(self, xmlSchemaElement, &rxml_schema_element_type, xelem);
45
45
 
46
46
  if ((xelem->annot != NULL) && (xelem->annot->content != NULL))
47
47
  {
@@ -1,11 +1,11 @@
1
- #ifndef __RXML_SCHEMA_ELEMENT__
2
- #define __RXML_SCHEMA_ELEMENT__
3
-
4
- #include "ruby_xml_schema.h"
5
-
6
- extern VALUE cXMLSchemaElement;
7
-
8
- VALUE rxml_wrap_schema_element(xmlSchemaElementPtr xelement);
9
- void rxml_init_schema_element(void);
10
-
11
- #endif
1
+ #ifndef __RXML_SCHEMA_ELEMENT__
2
+ #define __RXML_SCHEMA_ELEMENT__
3
+
4
+ #include "ruby_xml_schema.h"
5
+
6
+ extern VALUE cXMLSchemaElement;
7
+
8
+ VALUE rxml_wrap_schema_element(xmlSchemaElementPtr xelement);
9
+ void rxml_init_schema_element(void);
10
+
11
+ #endif
@@ -1,50 +1,50 @@
1
- #include "ruby_libxml.h"
2
- #include "ruby_xml_schema_facet.h"
3
-
4
- #include <libxml/schemasInternals.h>
5
- #include <libxml/xmlschemas.h>
6
- #include <libxml/xmlschemastypes.h>
7
-
8
- VALUE cXMLSchemaFacet;
9
-
10
- static void rxml_schema_facet_free(xmlSchemaFacetPtr xschema_type)
11
- {
12
- xschema_type = NULL;
13
- xmlFree(xschema_type);
14
- }
15
-
16
- VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet)
17
- {
18
- VALUE result;
19
-
20
- if (!facet)
21
- rb_raise(rb_eArgError, "XML::Schema::Facet required!");
22
-
23
- result = Data_Wrap_Struct(cXMLSchemaFacet, NULL, rxml_schema_facet_free, facet);
24
-
25
- rb_iv_set(result, "@kind", INT2NUM(facet->type));
26
- rb_iv_set(result, "@value", QNIL_OR_STRING(facet->value));
27
-
28
- return result;
29
-
30
- }
31
-
32
- /* START FACET*/
33
-
34
- static VALUE rxml_schema_facet_node(VALUE self)
35
- {
36
- xmlSchemaFacetPtr facet;
37
-
38
- Data_Get_Struct(self, xmlSchemaFacet, facet);
39
-
40
- return rxml_node_wrap(facet->node);
41
- }
42
-
43
- void rxml_init_schema_facet(void)
44
- {
45
- cXMLSchemaFacet = rb_define_class_under(cXMLSchema, "Facet", rb_cObject);
46
- rb_define_attr(cXMLSchemaFacet, "kind", 1, 0);
47
- rb_define_attr(cXMLSchemaFacet, "value", 1, 0);
48
-
49
- rb_define_method(cXMLSchemaFacet, "node", rxml_schema_facet_node, 0);
50
- }
1
+ #include "ruby_libxml.h"
2
+ #include "ruby_xml_schema_facet.h"
3
+
4
+ #include <libxml/schemasInternals.h>
5
+ #include <libxml/xmlschemas.h>
6
+ #include <libxml/xmlschemastypes.h>
7
+
8
+ VALUE cXMLSchemaFacet;
9
+
10
+ static const rb_data_type_t rxml_schema_facet_type = {
11
+ "XML::Schema::Facet",
12
+ {NULL, NULL, NULL},
13
+ NULL, NULL, 0
14
+ };
15
+
16
+ VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet)
17
+ {
18
+ VALUE result;
19
+
20
+ if (!facet)
21
+ rb_raise(rb_eArgError, "XML::Schema::Facet required!");
22
+
23
+ result = TypedData_Wrap_Struct(cXMLSchemaFacet, &rxml_schema_facet_type, facet);
24
+
25
+ rb_iv_set(result, "@kind", INT2NUM(facet->type));
26
+ rb_iv_set(result, "@value", QNIL_OR_STRING(facet->value));
27
+
28
+ return result;
29
+
30
+ }
31
+
32
+ /* START FACET*/
33
+
34
+ static VALUE rxml_schema_facet_node(VALUE self)
35
+ {
36
+ xmlSchemaFacetPtr facet;
37
+
38
+ TypedData_Get_Struct(self, xmlSchemaFacet, &rxml_schema_facet_type, facet);
39
+
40
+ return rxml_node_wrap(facet->node);
41
+ }
42
+
43
+ void rxml_init_schema_facet(void)
44
+ {
45
+ cXMLSchemaFacet = rb_define_class_under(cXMLSchema, "Facet", rb_cObject);
46
+ rb_define_attr(cXMLSchemaFacet, "kind", 1, 0);
47
+ rb_define_attr(cXMLSchemaFacet, "value", 1, 0);
48
+
49
+ rb_define_method(cXMLSchemaFacet, "node", rxml_schema_facet_node, 0);
50
+ }
@@ -1,9 +1,9 @@
1
- #ifndef __RXML_SCHEMA_FACET__
2
- #define __RXML_SCHEMA_FACET__
3
-
4
- extern VALUE cXMLSchemaFacet;
5
-
6
- VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet);
7
- void rxml_init_schema_facet(void);
8
-
9
- #endif
1
+ #ifndef __RXML_SCHEMA_FACET__
2
+ #define __RXML_SCHEMA_FACET__
3
+
4
+ extern VALUE cXMLSchemaFacet;
5
+
6
+ VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet);
7
+ void rxml_init_schema_facet(void);
8
+
9
+ #endif
@@ -46,11 +46,11 @@ a group definition, a XML_SCHEMA_EXTRA_QNAMEREF (if a reference),
46
46
 
47
47
  VALUE cXMLSchemaType;
48
48
 
49
- static void rxml_schema_type_free(xmlSchemaTypePtr xschema_type)
50
- {
51
- xschema_type = NULL;
52
- xmlFree(xschema_type);
53
- }
49
+ static const rb_data_type_t rxml_schema_type_type = {
50
+ "XML::Schema::Type",
51
+ {NULL, NULL, NULL},
52
+ NULL, NULL, 0
53
+ };
54
54
 
55
55
  VALUE rxml_wrap_schema_type(xmlSchemaTypePtr xtype)
56
56
  {
@@ -59,7 +59,7 @@ VALUE rxml_wrap_schema_type(xmlSchemaTypePtr xtype)
59
59
  if (!xtype)
60
60
  rb_raise(rb_eArgError, "XML::Schema::Type required!");
61
61
 
62
- result = Data_Wrap_Struct(cXMLSchemaType, NULL, rxml_schema_type_free, xtype);
62
+ result = TypedData_Wrap_Struct(cXMLSchemaType, &rxml_schema_type_type, xtype);
63
63
 
64
64
  rb_iv_set(result, "@name", QNIL_OR_STRING(xtype->name));
65
65
  rb_iv_set(result, "@namespace", QNIL_OR_STRING(xtype->targetNamespace));
@@ -72,7 +72,7 @@ static VALUE rxml_schema_type_base(VALUE self)
72
72
  {
73
73
  xmlSchemaTypePtr xtype;
74
74
 
75
- Data_Get_Struct(self, xmlSchemaType, xtype);
75
+ TypedData_Get_Struct(self, xmlSchemaType, &rxml_schema_type_type, xtype);
76
76
 
77
77
  return (xtype->baseType != xtype) ? rxml_wrap_schema_type(xtype->baseType) : Qnil;
78
78
  }
@@ -81,7 +81,7 @@ static VALUE rxml_schema_type_node(VALUE self)
81
81
  {
82
82
  xmlSchemaTypePtr xtype;
83
83
 
84
- Data_Get_Struct(self, xmlSchemaType, xtype);
84
+ TypedData_Get_Struct(self, xmlSchemaType, &rxml_schema_type_type, xtype);
85
85
 
86
86
  return (xtype->node != NULL) ? rxml_node_wrap(xtype->node) : Qnil;
87
87
  }
@@ -93,7 +93,7 @@ static VALUE rxml_schema_type_facets(VALUE self)
93
93
  VALUE result = rb_ary_new();
94
94
  VALUE facet;
95
95
 
96
- Data_Get_Struct(self, xmlSchemaType, xtype);
96
+ TypedData_Get_Struct(self, xmlSchemaType, &rxml_schema_type_type, xtype);
97
97
 
98
98
  xfacet = xtype->facets;
99
99
 
@@ -112,7 +112,7 @@ static VALUE rxml_schema_type_annot(VALUE self)
112
112
  VALUE result = Qnil;
113
113
  xmlSchemaTypePtr xtype;
114
114
 
115
- Data_Get_Struct(self, xmlSchemaType, xtype);
115
+ TypedData_Get_Struct(self, xmlSchemaType, &rxml_schema_type_type, xtype);
116
116
 
117
117
  if(xtype != NULL && xtype->annot != NULL && xtype->annot->content != NULL)
118
118
  {
@@ -198,7 +198,7 @@ static VALUE rxml_schema_type_elements(VALUE self)
198
198
  VALUE result = rb_hash_new();
199
199
  xmlSchemaTypePtr xtype;
200
200
 
201
- Data_Get_Struct(self, xmlSchemaType, xtype);
201
+ TypedData_Get_Struct(self, xmlSchemaType, &rxml_schema_type_type, xtype);
202
202
  rxmlSchemaCollectElements((xmlSchemaParticlePtr) xtype->subtypes, result);
203
203
 
204
204
  return result;
@@ -212,7 +212,7 @@ static VALUE rxml_schema_type_attributes(VALUE self)
212
212
  xmlSchemaItemListPtr xuses;
213
213
  int i;
214
214
 
215
- Data_Get_Struct(self, xmlSchemaType, xtype);
215
+ TypedData_Get_Struct(self, xmlSchemaType, &rxml_schema_type_type, xtype);
216
216
  xuses = xtype->attrUses;
217
217
 
218
218
  if (xuses != NULL)
@@ -229,13 +229,6 @@ static VALUE rxml_schema_type_attributes(VALUE self)
229
229
 
230
230
  void rxml_init_schema_type(void)
231
231
  {
232
- /* Add in infinity support for ruby 1.8.7 */
233
- #if !defined(RUBY_VM) && defined(INFINITY)
234
- ID infinityId = rb_intern("INFINITY");
235
- if (rb_const_defined(rb_cFloat, infinityId) == Qfalse)
236
- rb_define_const(rb_cFloat, "INFINITY", rb_float_new(INFINITY));
237
- #endif
238
-
239
232
  cXMLSchemaType = rb_define_class_under(cXMLSchema, "Type", rb_cObject);
240
233
  rb_undef_alloc_func(cXMLSchemaType);
241
234
 
@@ -1,9 +1,9 @@
1
- #ifndef __RXML_SCHEMA_TYPE__
2
- #define __RXML_SCHEMA_TYPE__
3
-
4
- extern VALUE cXMLSchemaType;
5
-
6
- VALUE rxml_wrap_schema_type(xmlSchemaTypePtr xtype);
7
- void rxml_init_schema_type(void);
8
-
9
- #endif
1
+ #ifndef __RXML_SCHEMA_TYPE__
2
+ #define __RXML_SCHEMA_TYPE__
3
+
4
+ extern VALUE cXMLSchemaType;
5
+
6
+ VALUE rxml_wrap_schema_type(xmlSchemaTypePtr xtype);
7
+ void rxml_init_schema_type(void);
8
+
9
+ #endif
@@ -1,9 +1,9 @@
1
1
  /* Don't nuke this block! It is used for automatically updating the
2
2
  * versions below. VERSION = string formatting, VERNUM = numbered
3
3
  * version for inline testing: increment both or none at all.*/
4
- #define RUBY_LIBXML_VERSION "5.0.5"
5
- #define RUBY_LIBXML_VERNUM 505
6
- #define RUBY_LIBXML_VER_MAJ 5
4
+ #define RUBY_LIBXML_VERSION "6.0.0"
5
+ #define RUBY_LIBXML_VERNUM 600
6
+ #define RUBY_LIBXML_VER_MAJ 6
7
7
  #define RUBY_LIBXML_VER_MIN 0
8
- #define RUBY_LIBXML_VER_MIC 5
8
+ #define RUBY_LIBXML_VER_MIC 0
9
9
  #define RUBY_LIBXML_VER_PATCH 0