libxml-ruby 4.0.0-x64-mingw-ucrt → 4.1.2-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,107 +1,108 @@
1
- #include "ruby_libxml.h"
2
- #include "ruby_xml_schema_attribute.h"
3
- #include "ruby_xml_schema_type.h"
4
-
5
- /**
6
- * xmlSchemaBasicItem:
7
- *
8
- * The abstract base type for schema components.
9
- */
10
- typedef struct _xmlSchemaBasicItem xmlSchemaBasicItem;
11
- typedef xmlSchemaBasicItem *xmlSchemaBasicItemPtr;
12
- struct _xmlSchemaBasicItem {
13
- xmlSchemaTypeType type;
14
- };
15
-
16
- /**
17
- * xmlSchemaQNameRef:
18
- *
19
- * A component reference item (not a schema component)
20
- * (Extends xmlSchemaBasicItem)
21
- */
22
- typedef struct _xmlSchemaQNameRef xmlSchemaQNameRef;
23
- typedef xmlSchemaQNameRef *xmlSchemaQNameRefPtr;
24
- struct _xmlSchemaQNameRef {
25
- xmlSchemaTypeType type;
26
- xmlSchemaBasicItemPtr item;
27
- /* The resolved referenced item. */
28
- xmlSchemaTypeType itemType;
29
- const xmlChar *name;
30
- const xmlChar *targetNamespace;
31
- xmlNodePtr node;
32
- };
33
-
34
- /**
35
- * xmlSchemaAttributeUseProhibPtr:
36
- *
37
- * A helper component to reflect attribute prohibitions.
38
- * (Extends xmlSchemaBasicItem)
39
- */
40
- typedef struct _xmlSchemaAttributeUseProhib xmlSchemaAttributeUseProhib;
41
- typedef xmlSchemaAttributeUseProhib *xmlSchemaAttributeUseProhibPtr;
42
- struct _xmlSchemaAttributeUseProhib {
43
- xmlSchemaTypeType type;
44
- /* == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB */
45
- xmlNodePtr node;
46
- const xmlChar *name;
47
- const xmlChar *targetNamespace;
48
- int isRef;
49
- };
50
-
51
- VALUE cXMLSchemaAttribute;
52
-
53
- static void rxml_schema_attribute_free(xmlSchemaAttributeUsePtr attr)
54
- {
55
- attr = NULL;
56
- xmlFree(attr);
57
- }
58
-
59
- VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr)
60
- {
61
- VALUE result;
62
- const xmlChar *tns_str, *name_str;
63
-
64
- if (!attr)
65
- rb_raise(rb_eArgError, "XML::Schema::Attribute required!");
66
-
67
- result = Data_Wrap_Struct(cXMLSchemaAttribute, NULL, rxml_schema_attribute_free, attr);
68
-
69
- if (attr->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) {
70
- tns_str = ((xmlSchemaAttributeUseProhibPtr) attr)->targetNamespace;
71
- name_str = ((xmlSchemaAttributeUseProhibPtr) attr)->name;
72
- } else if (attr->type == XML_SCHEMA_EXTRA_QNAMEREF) {
73
- tns_str = ((xmlSchemaQNameRefPtr) attr)->targetNamespace;
74
- name_str = ((xmlSchemaQNameRefPtr) attr)->name;
75
- } else {
76
- tns_str = ((xmlSchemaAttributePtr) (attr->attrDecl))->targetNamespace;
77
- name_str = ((xmlSchemaAttributePtr) (attr->attrDecl))->name;
78
- }
79
- rb_iv_set(result, "@target_namespace", QNIL_OR_STRING(tns_str));
80
- rb_iv_set(result, "@name", QNIL_OR_STRING(name_str));
81
- rb_iv_set(result, "@type", rxml_wrap_schema_type((xmlSchemaTypePtr)attr->attrDecl->subtypes));
82
- rb_iv_set(result, "@value", QNIL_OR_STRING(attr->defValue));
83
- rb_iv_set(result, "@occurs", INT2NUM(attr->occurs));
84
-
85
- return result;
86
- }
87
-
88
- static VALUE rxml_schema_attribute_node(VALUE self)
89
- {
90
- xmlSchemaAttributeUsePtr attr;
91
-
92
- Data_Get_Struct(self, xmlSchemaAttributeUse, attr);
93
-
94
- return rxml_node_wrap(attr->node);
95
- }
96
-
97
- void rxml_init_schema_attribute(void)
98
- {
99
- cXMLSchemaAttribute = rb_define_class_under(cXMLSchema, "Attribute", rb_cObject);
100
- rb_define_attr(cXMLSchemaAttribute, "name", 1, 0);
101
- rb_define_attr(cXMLSchemaAttribute, "type", 1, 0);
102
- rb_define_attr(cXMLSchemaAttribute, "namespace", 1, 0);
103
- rb_define_attr(cXMLSchemaAttribute, "value", 1, 0);
104
- rb_define_attr(cXMLSchemaAttribute, "occurs", 1, 0);
105
-
106
- rb_define_method(cXMLSchemaAttribute, "node", rxml_schema_attribute_node, 0);
107
- }
1
+ #include "ruby_libxml.h"
2
+ #include "ruby_xml_schema_attribute.h"
3
+ #include "ruby_xml_schema_type.h"
4
+
5
+ /**
6
+ * xmlSchemaBasicItem:
7
+ *
8
+ * The abstract base type for schema components.
9
+ */
10
+ typedef struct _xmlSchemaBasicItem xmlSchemaBasicItem;
11
+ typedef xmlSchemaBasicItem *xmlSchemaBasicItemPtr;
12
+ struct _xmlSchemaBasicItem {
13
+ xmlSchemaTypeType type;
14
+ };
15
+
16
+ /**
17
+ * xmlSchemaQNameRef:
18
+ *
19
+ * A component reference item (not a schema component)
20
+ * (Extends xmlSchemaBasicItem)
21
+ */
22
+ typedef struct _xmlSchemaQNameRef xmlSchemaQNameRef;
23
+ typedef xmlSchemaQNameRef *xmlSchemaQNameRefPtr;
24
+ struct _xmlSchemaQNameRef {
25
+ xmlSchemaTypeType type;
26
+ xmlSchemaBasicItemPtr item;
27
+ /* The resolved referenced item. */
28
+ xmlSchemaTypeType itemType;
29
+ const xmlChar *name;
30
+ const xmlChar *targetNamespace;
31
+ xmlNodePtr node;
32
+ };
33
+
34
+ /**
35
+ * xmlSchemaAttributeUseProhibPtr:
36
+ *
37
+ * A helper component to reflect attribute prohibitions.
38
+ * (Extends xmlSchemaBasicItem)
39
+ */
40
+ typedef struct _xmlSchemaAttributeUseProhib xmlSchemaAttributeUseProhib;
41
+ typedef xmlSchemaAttributeUseProhib *xmlSchemaAttributeUseProhibPtr;
42
+ struct _xmlSchemaAttributeUseProhib {
43
+ xmlSchemaTypeType type;
44
+ /* == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB */
45
+ xmlNodePtr node;
46
+ const xmlChar *name;
47
+ const xmlChar *targetNamespace;
48
+ int isRef;
49
+ };
50
+
51
+ VALUE cXMLSchemaAttribute;
52
+
53
+ static void rxml_schema_attribute_free(xmlSchemaAttributeUsePtr attr)
54
+ {
55
+ attr = NULL;
56
+ xmlFree(attr);
57
+ }
58
+
59
+ VALUE rxml_wrap_schema_attribute(xmlSchemaAttributeUsePtr attr)
60
+ {
61
+ VALUE result;
62
+ const xmlChar *tns_str, *name_str;
63
+
64
+ if (!attr)
65
+ rb_raise(rb_eArgError, "XML::Schema::Attribute required!");
66
+
67
+ result = Data_Wrap_Struct(cXMLSchemaAttribute, NULL, rxml_schema_attribute_free, attr);
68
+
69
+ if (attr->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) {
70
+ tns_str = ((xmlSchemaAttributeUseProhibPtr) attr)->targetNamespace;
71
+ name_str = ((xmlSchemaAttributeUseProhibPtr) attr)->name;
72
+ } else if (attr->type == XML_SCHEMA_EXTRA_QNAMEREF) {
73
+ tns_str = ((xmlSchemaQNameRefPtr) attr)->targetNamespace;
74
+ name_str = ((xmlSchemaQNameRefPtr) attr)->name;
75
+ } else {
76
+ tns_str = ((xmlSchemaAttributePtr) (attr->attrDecl))->targetNamespace;
77
+ name_str = ((xmlSchemaAttributePtr) (attr->attrDecl))->name;
78
+ }
79
+ rb_iv_set(result, "@target_namespace", QNIL_OR_STRING(tns_str));
80
+ rb_iv_set(result, "@name", QNIL_OR_STRING(name_str));
81
+ rb_iv_set(result, "@type", rxml_wrap_schema_type((xmlSchemaTypePtr)attr->attrDecl->subtypes));
82
+ rb_iv_set(result, "@value", QNIL_OR_STRING(attr->defValue));
83
+ rb_iv_set(result, "@occurs", INT2NUM(attr->occurs));
84
+
85
+ return result;
86
+ }
87
+
88
+ static VALUE rxml_schema_attribute_node(VALUE self)
89
+ {
90
+ xmlSchemaAttributeUsePtr attr;
91
+
92
+ Data_Get_Struct(self, xmlSchemaAttributeUse, attr);
93
+
94
+ return rxml_node_wrap(attr->node);
95
+ }
96
+
97
+ void rxml_init_schema_attribute(void)
98
+ {
99
+ cXMLSchemaAttribute = rb_define_class_under(cXMLSchema, "Attribute", rb_cObject);
100
+ rb_undef_alloc_func(cXMLSchemaAttribute);
101
+ rb_define_attr(cXMLSchemaAttribute, "name", 1, 0);
102
+ rb_define_attr(cXMLSchemaAttribute, "type", 1, 0);
103
+ rb_define_attr(cXMLSchemaAttribute, "namespace", 1, 0);
104
+ rb_define_attr(cXMLSchemaAttribute, "value", 1, 0);
105
+ rb_define_attr(cXMLSchemaAttribute, "occurs", 1, 0);
106
+
107
+ rb_define_method(cXMLSchemaAttribute, "node", rxml_schema_attribute_node, 0);
108
+ }
@@ -1,69 +1,70 @@
1
- #include "ruby_libxml.h"
2
- #include "ruby_xml_schema_element.h"
3
- #include "ruby_xml_schema_type.h"
4
-
5
- VALUE cXMLSchemaElement;
6
-
7
- static void rxml_schema_element_free(xmlSchemaElementPtr xschema_element)
8
- {
9
- xschema_element = NULL;
10
- xmlFree(xschema_element);
11
- }
12
-
13
- VALUE rxml_wrap_schema_element(xmlSchemaElementPtr xelem)
14
- {
15
- VALUE result;
16
-
17
- if (!xelem)
18
- rb_raise(rb_eArgError, "XML::Schema::Element is required!");
19
-
20
- result = Data_Wrap_Struct(cXMLSchemaElement, NULL, rxml_schema_element_free, xelem);
21
-
22
- rb_iv_set(result, "@name", QNIL_OR_STRING(xelem->name));
23
- rb_iv_set(result, "@value", QNIL_OR_STRING(xelem->value));
24
- rb_iv_set(result, "@namespace", QNIL_OR_STRING(xelem->targetNamespace));
25
- rb_iv_set(result, "@type", rxml_wrap_schema_type((xmlSchemaTypePtr) (xelem->subtypes)));
26
-
27
- return result;
28
- }
29
-
30
- static VALUE rxml_schema_element_node(VALUE self)
31
- {
32
- xmlSchemaElementPtr xelem;
33
-
34
- Data_Get_Struct(self, xmlSchemaElement, xelem);
35
-
36
- return rxml_node_wrap(xelem->node);
37
- }
38
-
39
- static VALUE rxml_schema_element_annot(VALUE self)
40
- {
41
- xmlSchemaElementPtr xelem;
42
- VALUE annotation = Qnil;
43
-
44
- Data_Get_Struct(self, xmlSchemaElement, xelem);
45
-
46
- if ((xelem->annot != NULL) && (xelem->annot->content != NULL))
47
- {
48
- xmlChar *content = xmlNodeGetContent(xelem->annot->content);
49
- if (content)
50
- {
51
- annotation = rxml_new_cstr(content, NULL);
52
- xmlFree(content);
53
- }
54
- }
55
-
56
- return annotation;
57
- }
58
-
59
- void rxml_init_schema_element(void)
60
- {
61
- cXMLSchemaElement = rb_define_class_under(cXMLSchema, "Element", rb_cObject);
62
- rb_define_attr(cXMLSchemaElement, "name", 1, 0);
63
- rb_define_attr(cXMLSchemaElement, "value", 1, 0);
64
- rb_define_attr(cXMLSchemaElement, "namespace", 1, 0);
65
- rb_define_attr(cXMLSchemaElement, "type", 1, 0);
66
-
67
- rb_define_method(cXMLSchemaElement, "node", rxml_schema_element_node, 0);
68
- rb_define_method(cXMLSchemaElement, "annotation", rxml_schema_element_annot, 0);
69
- }
1
+ #include "ruby_libxml.h"
2
+ #include "ruby_xml_schema_element.h"
3
+ #include "ruby_xml_schema_type.h"
4
+
5
+ VALUE cXMLSchemaElement;
6
+
7
+ static void rxml_schema_element_free(xmlSchemaElementPtr xschema_element)
8
+ {
9
+ xschema_element = NULL;
10
+ xmlFree(xschema_element);
11
+ }
12
+
13
+ VALUE rxml_wrap_schema_element(xmlSchemaElementPtr xelem)
14
+ {
15
+ VALUE result;
16
+
17
+ if (!xelem)
18
+ rb_raise(rb_eArgError, "XML::Schema::Element is required!");
19
+
20
+ result = Data_Wrap_Struct(cXMLSchemaElement, NULL, rxml_schema_element_free, xelem);
21
+
22
+ rb_iv_set(result, "@name", QNIL_OR_STRING(xelem->name));
23
+ rb_iv_set(result, "@value", QNIL_OR_STRING(xelem->value));
24
+ rb_iv_set(result, "@namespace", QNIL_OR_STRING(xelem->targetNamespace));
25
+ rb_iv_set(result, "@type", rxml_wrap_schema_type((xmlSchemaTypePtr) (xelem->subtypes)));
26
+
27
+ return result;
28
+ }
29
+
30
+ static VALUE rxml_schema_element_node(VALUE self)
31
+ {
32
+ xmlSchemaElementPtr xelem;
33
+
34
+ Data_Get_Struct(self, xmlSchemaElement, xelem);
35
+
36
+ return rxml_node_wrap(xelem->node);
37
+ }
38
+
39
+ static VALUE rxml_schema_element_annot(VALUE self)
40
+ {
41
+ xmlSchemaElementPtr xelem;
42
+ VALUE annotation = Qnil;
43
+
44
+ Data_Get_Struct(self, xmlSchemaElement, xelem);
45
+
46
+ if ((xelem->annot != NULL) && (xelem->annot->content != NULL))
47
+ {
48
+ xmlChar *content = xmlNodeGetContent(xelem->annot->content);
49
+ if (content)
50
+ {
51
+ annotation = rxml_new_cstr(content, NULL);
52
+ xmlFree(content);
53
+ }
54
+ }
55
+
56
+ return annotation;
57
+ }
58
+
59
+ void rxml_init_schema_element(void)
60
+ {
61
+ cXMLSchemaElement = rb_define_class_under(cXMLSchema, "Element", rb_cObject);
62
+ rb_undef_alloc_func(cXMLSchemaElement);
63
+ rb_define_attr(cXMLSchemaElement, "name", 1, 0);
64
+ rb_define_attr(cXMLSchemaElement, "value", 1, 0);
65
+ rb_define_attr(cXMLSchemaElement, "namespace", 1, 0);
66
+ rb_define_attr(cXMLSchemaElement, "type", 1, 0);
67
+
68
+ rb_define_method(cXMLSchemaElement, "node", rxml_schema_element_node, 0);
69
+ rb_define_method(cXMLSchemaElement, "annotation", rxml_schema_element_annot, 0);
70
+ }