libxml-ruby 4.1.1 → 5.0.3

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY +33 -0
  3. data/README.rdoc +7 -16
  4. data/ext/libxml/extconf.rb +67 -61
  5. data/ext/libxml/ruby_libxml.h +43 -44
  6. data/ext/libxml/ruby_xml.c +0 -343
  7. data/ext/libxml/ruby_xml.h +9 -10
  8. data/ext/libxml/ruby_xml_attr_decl.c +154 -153
  9. data/ext/libxml/ruby_xml_attributes.c +276 -275
  10. data/ext/libxml/ruby_xml_attributes.h +2 -0
  11. data/ext/libxml/ruby_xml_document.c +6 -6
  12. data/ext/libxml/ruby_xml_document.h +11 -11
  13. data/ext/libxml/ruby_xml_dtd.c +95 -86
  14. data/ext/libxml/ruby_xml_encoding.h +20 -18
  15. data/ext/libxml/ruby_xml_error.c +12 -5
  16. data/ext/libxml/ruby_xml_error.h +2 -2
  17. data/ext/libxml/ruby_xml_html_parser_context.c +35 -21
  18. data/ext/libxml/ruby_xml_namespace.c +0 -3
  19. data/ext/libxml/ruby_xml_node.c +1394 -1398
  20. data/ext/libxml/ruby_xml_parser.h +1 -1
  21. data/ext/libxml/ruby_xml_parser_context.c +47 -39
  22. data/ext/libxml/ruby_xml_parser_options.c +9 -1
  23. data/ext/libxml/ruby_xml_parser_options.h +1 -1
  24. data/ext/libxml/ruby_xml_reader.c +1244 -1242
  25. data/ext/libxml/ruby_xml_relaxng.c +113 -112
  26. data/ext/libxml/ruby_xml_sax2_handler.c +1 -1
  27. data/ext/libxml/ruby_xml_sax_parser.c +1 -9
  28. data/ext/libxml/ruby_xml_schema.c +422 -420
  29. data/ext/libxml/ruby_xml_schema_attribute.c +108 -107
  30. data/ext/libxml/ruby_xml_schema_element.c +70 -69
  31. data/ext/libxml/ruby_xml_schema_type.c +252 -251
  32. data/ext/libxml/ruby_xml_version.h +5 -5
  33. data/ext/libxml/ruby_xml_writer.c +1138 -1137
  34. data/ext/libxml/ruby_xml_xpath.c +1 -1
  35. data/ext/libxml/ruby_xml_xpath_context.c +2 -2
  36. data/ext/libxml/ruby_xml_xpath_expression.c +81 -81
  37. data/ext/libxml/ruby_xml_xpath_object.c +340 -339
  38. data/lib/libxml/document.rb +15 -15
  39. data/lib/libxml/html_parser.rb +23 -23
  40. data/lib/libxml/parser.rb +26 -24
  41. data/lib/libxml/schema/element.rb +27 -19
  42. data/test/test.rb +5 -0
  43. data/test/test_document.rb +9 -1
  44. data/test/test_document_write.rb +1 -4
  45. data/test/test_dtd.rb +5 -8
  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 +4 -3
@@ -1,10 +1,9 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RUBY_XML_H__
4
- #define __RUBY_XML_H__
5
-
6
- extern VALUE mXML;
7
- int rxml_libxml_default_options(void);
8
- void rxml_init_xml(void);
9
-
10
- #endif
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #ifndef __RUBY_XML_H__
4
+ #define __RUBY_XML_H__
5
+
6
+ extern VALUE mXML;
7
+ void rxml_init_xml(void);
8
+
9
+ #endif
@@ -1,153 +1,154 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- /*
4
- * Document-class: LibXML::XML::AttrDecl
5
- *
6
- * At attribute declaration is used in XML::Dtds to define
7
- * what attributes are allowed on an element. An attribute
8
- * declaration defines an attribues name, data type and default
9
- * value (if any).
10
- */
11
-
12
- #include "ruby_libxml.h"
13
-
14
- VALUE cXMLAttrDecl;
15
-
16
- void rxml_attr_decl_mark(xmlAttributePtr xattr)
17
- {
18
- rxml_node_mark((xmlNodePtr) xattr);
19
- }
20
-
21
- VALUE rxml_attr_decl_wrap(xmlAttributePtr xattr)
22
- {
23
- return Data_Wrap_Struct(cXMLAttrDecl, rxml_attr_decl_mark, NULL, xattr);
24
- }
25
-
26
- /*
27
- * call-seq:
28
- * attr_decl.doc -> XML::Document
29
- *
30
- * Returns this attribute declaration's document.
31
- */
32
- static VALUE rxml_attr_decl_doc_get(VALUE self)
33
- {
34
- xmlAttributePtr xattr;
35
- Data_Get_Struct(self, xmlAttribute, xattr);
36
- if (xattr->doc == NULL)
37
- return Qnil;
38
- else
39
- return rxml_document_wrap(xattr->doc);
40
- }
41
-
42
-
43
- /*
44
- * call-seq:
45
- * attr_decl.name -> "name"
46
- *
47
- * Obtain this attribute declaration's name.
48
- */
49
- static VALUE rxml_attr_decl_name_get(VALUE self)
50
- {
51
- xmlAttributePtr xattr;
52
- Data_Get_Struct(self, xmlAttribute, xattr);
53
-
54
- if (xattr->name == NULL)
55
- return Qnil;
56
- else
57
- return rxml_new_cstr( xattr->name, xattr->doc->encoding);
58
- }
59
-
60
- /*
61
- * call-seq:
62
- * attr_decl.next -> XML::AttrDecl
63
- *
64
- * Obtain the next attribute declaration.
65
- */
66
- static VALUE rxml_attr_decl_next_get(VALUE self)
67
- {
68
- xmlAttributePtr xattr;
69
- Data_Get_Struct(self, xmlAttribute, xattr);
70
- if (xattr->next == NULL)
71
- return Qnil;
72
- else
73
- return rxml_attr_decl_wrap((xmlAttributePtr)xattr->next);
74
- }
75
-
76
- /*
77
- * call-seq:
78
- * attr_decl.type -> num
79
- *
80
- * Obtain this attribute declaration's type node type.
81
- */
82
- static VALUE rxml_attr_decl_node_type(VALUE self)
83
- {
84
- xmlAttrPtr xattr;
85
- Data_Get_Struct(self, xmlAttr, xattr);
86
- return INT2NUM(xattr->type);
87
- }
88
-
89
- /*
90
- * call-seq:
91
- * attr_decl.parent -> XML::Dtd
92
- *
93
- * Obtain this attribute declaration's parent which
94
- * is an instance of a XML::DTD.
95
- */
96
- static VALUE rxml_attr_decl_parent_get(VALUE self)
97
- {
98
- xmlAttributePtr xattr;
99
- Data_Get_Struct(self, xmlAttribute, xattr);
100
-
101
- if (xattr->parent == NULL)
102
- return Qnil;
103
- else
104
- return rxml_dtd_wrap(xattr->parent);
105
- }
106
-
107
- /*
108
- * call-seq:
109
- * attr_decl.prev -> (XML::AttrDecl | XML::ElementDecl)
110
- *
111
- * Obtain the previous attribute declaration or the owning
112
- * element declration (not implemented).
113
- */
114
- static VALUE rxml_attr_decl_prev_get(VALUE self)
115
- {
116
- xmlAttributePtr xattr;
117
- Data_Get_Struct(self, xmlAttribute, xattr);
118
-
119
- if (xattr->prev == NULL)
120
- return Qnil;
121
- else
122
- return rxml_attr_decl_wrap((xmlAttributePtr)xattr->prev);
123
- }
124
-
125
- /*
126
- * call-seq:
127
- * attr_decl.value -> "value"
128
- *
129
- * Obtain the default value of this attribute declaration.
130
- */
131
- VALUE rxml_attr_decl_value_get(VALUE self)
132
- {
133
- xmlAttributePtr xattr;
134
-
135
- Data_Get_Struct(self, xmlAttribute, xattr);
136
-
137
- if (xattr->defaultValue)
138
- return rxml_new_cstr(xattr->defaultValue, NULL);
139
- else
140
- return Qnil;
141
- }
142
-
143
- void rxml_init_attr_decl(void)
144
- {
145
- cXMLAttrDecl = rb_define_class_under(mXML, "AttrDecl", rb_cObject);
146
- rb_define_method(cXMLAttrDecl, "doc", rxml_attr_decl_doc_get, 0);
147
- rb_define_method(cXMLAttrDecl, "name", rxml_attr_decl_name_get, 0);
148
- rb_define_method(cXMLAttrDecl, "next", rxml_attr_decl_next_get, 0);
149
- rb_define_method(cXMLAttrDecl, "node_type", rxml_attr_decl_node_type, 0);
150
- rb_define_method(cXMLAttrDecl, "parent", rxml_attr_decl_parent_get, 0);
151
- rb_define_method(cXMLAttrDecl, "prev", rxml_attr_decl_prev_get, 0);
152
- rb_define_method(cXMLAttrDecl, "value", rxml_attr_decl_value_get, 0);
153
- }
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ /*
4
+ * Document-class: LibXML::XML::AttrDecl
5
+ *
6
+ * At attribute declaration is used in XML::Dtds to define
7
+ * what attributes are allowed on an element. An attribute
8
+ * declaration defines an attribues name, data type and default
9
+ * value (if any).
10
+ */
11
+
12
+ #include "ruby_libxml.h"
13
+
14
+ VALUE cXMLAttrDecl;
15
+
16
+ void rxml_attr_decl_mark(xmlAttributePtr xattr)
17
+ {
18
+ rxml_node_mark((xmlNodePtr) xattr);
19
+ }
20
+
21
+ VALUE rxml_attr_decl_wrap(xmlAttributePtr xattr)
22
+ {
23
+ return Data_Wrap_Struct(cXMLAttrDecl, rxml_attr_decl_mark, NULL, xattr);
24
+ }
25
+
26
+ /*
27
+ * call-seq:
28
+ * attr_decl.doc -> XML::Document
29
+ *
30
+ * Returns this attribute declaration's document.
31
+ */
32
+ static VALUE rxml_attr_decl_doc_get(VALUE self)
33
+ {
34
+ xmlAttributePtr xattr;
35
+ Data_Get_Struct(self, xmlAttribute, xattr);
36
+ if (xattr->doc == NULL)
37
+ return Qnil;
38
+ else
39
+ return rxml_document_wrap(xattr->doc);
40
+ }
41
+
42
+
43
+ /*
44
+ * call-seq:
45
+ * attr_decl.name -> "name"
46
+ *
47
+ * Obtain this attribute declaration's name.
48
+ */
49
+ static VALUE rxml_attr_decl_name_get(VALUE self)
50
+ {
51
+ xmlAttributePtr xattr;
52
+ Data_Get_Struct(self, xmlAttribute, xattr);
53
+
54
+ if (xattr->name == NULL)
55
+ return Qnil;
56
+ else
57
+ return rxml_new_cstr( xattr->name, xattr->doc->encoding);
58
+ }
59
+
60
+ /*
61
+ * call-seq:
62
+ * attr_decl.next -> XML::AttrDecl
63
+ *
64
+ * Obtain the next attribute declaration.
65
+ */
66
+ static VALUE rxml_attr_decl_next_get(VALUE self)
67
+ {
68
+ xmlAttributePtr xattr;
69
+ Data_Get_Struct(self, xmlAttribute, xattr);
70
+ if (xattr->next == NULL)
71
+ return Qnil;
72
+ else
73
+ return rxml_attr_decl_wrap((xmlAttributePtr)xattr->next);
74
+ }
75
+
76
+ /*
77
+ * call-seq:
78
+ * attr_decl.type -> num
79
+ *
80
+ * Obtain this attribute declaration's type node type.
81
+ */
82
+ static VALUE rxml_attr_decl_node_type(VALUE self)
83
+ {
84
+ xmlAttrPtr xattr;
85
+ Data_Get_Struct(self, xmlAttr, xattr);
86
+ return INT2NUM(xattr->type);
87
+ }
88
+
89
+ /*
90
+ * call-seq:
91
+ * attr_decl.parent -> XML::Dtd
92
+ *
93
+ * Obtain this attribute declaration's parent which
94
+ * is an instance of a XML::DTD.
95
+ */
96
+ static VALUE rxml_attr_decl_parent_get(VALUE self)
97
+ {
98
+ xmlAttributePtr xattr;
99
+ Data_Get_Struct(self, xmlAttribute, xattr);
100
+
101
+ if (xattr->parent == NULL)
102
+ return Qnil;
103
+ else
104
+ return rxml_dtd_wrap(xattr->parent);
105
+ }
106
+
107
+ /*
108
+ * call-seq:
109
+ * attr_decl.prev -> (XML::AttrDecl | XML::ElementDecl)
110
+ *
111
+ * Obtain the previous attribute declaration or the owning
112
+ * element declration (not implemented).
113
+ */
114
+ static VALUE rxml_attr_decl_prev_get(VALUE self)
115
+ {
116
+ xmlAttributePtr xattr;
117
+ Data_Get_Struct(self, xmlAttribute, xattr);
118
+
119
+ if (xattr->prev == NULL)
120
+ return Qnil;
121
+ else
122
+ return rxml_attr_decl_wrap((xmlAttributePtr)xattr->prev);
123
+ }
124
+
125
+ /*
126
+ * call-seq:
127
+ * attr_decl.value -> "value"
128
+ *
129
+ * Obtain the default value of this attribute declaration.
130
+ */
131
+ VALUE rxml_attr_decl_value_get(VALUE self)
132
+ {
133
+ xmlAttributePtr xattr;
134
+
135
+ Data_Get_Struct(self, xmlAttribute, xattr);
136
+
137
+ if (xattr->defaultValue)
138
+ return rxml_new_cstr(xattr->defaultValue, NULL);
139
+ else
140
+ return Qnil;
141
+ }
142
+
143
+ void rxml_init_attr_decl(void)
144
+ {
145
+ cXMLAttrDecl = rb_define_class_under(mXML, "AttrDecl", rb_cObject);
146
+ rb_undef_alloc_func(cXMLAttrDecl);
147
+ rb_define_method(cXMLAttrDecl, "doc", rxml_attr_decl_doc_get, 0);
148
+ rb_define_method(cXMLAttrDecl, "name", rxml_attr_decl_name_get, 0);
149
+ rb_define_method(cXMLAttrDecl, "next", rxml_attr_decl_next_get, 0);
150
+ rb_define_method(cXMLAttrDecl, "node_type", rxml_attr_decl_node_type, 0);
151
+ rb_define_method(cXMLAttrDecl, "parent", rxml_attr_decl_parent_get, 0);
152
+ rb_define_method(cXMLAttrDecl, "prev", rxml_attr_decl_prev_get, 0);
153
+ rb_define_method(cXMLAttrDecl, "value", rxml_attr_decl_value_get, 0);
154
+ }