libxml-ruby 0.8.1-x86-mswin32-60 → 0.8.2-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/CHANGES +21 -0
  2. data/RAKEFILE +213 -0
  3. data/README +32 -11
  4. data/doc/rdoc/classes/LibXML.html +4 -0
  5. data/doc/rdoc/classes/LibXML/XML.html +7 -0
  6. data/doc/rdoc/classes/LibXML/XML/Attr.html +187 -177
  7. data/doc/rdoc/classes/LibXML/XML/Attributes.html +62 -61
  8. data/doc/rdoc/classes/LibXML/XML/Document.html +318 -254
  9. data/doc/rdoc/classes/LibXML/XML/Dtd.html +62 -8
  10. data/doc/rdoc/classes/LibXML/XML/Error.html +6 -0
  11. data/doc/rdoc/classes/LibXML/XML/HTMLParser.html +59 -41
  12. data/doc/rdoc/classes/LibXML/XML/InputCallbacks.html +12 -6
  13. data/doc/rdoc/classes/LibXML/XML/NS.html +65 -50
  14. data/doc/rdoc/classes/LibXML/XML/Node.html +671 -630
  15. data/doc/rdoc/classes/LibXML/XML/Node/FailedModify.html +12 -0
  16. data/doc/rdoc/classes/LibXML/XML/Node/Set.html +64 -60
  17. data/doc/rdoc/classes/LibXML/XML/Node/SetNamespace.html +12 -0
  18. data/doc/rdoc/classes/LibXML/XML/Node/UnknownType.html +12 -0
  19. data/doc/rdoc/classes/LibXML/XML/Parser.html +407 -383
  20. data/doc/rdoc/classes/LibXML/XML/Parser/Context.html +241 -219
  21. data/doc/rdoc/classes/LibXML/XML/Parser/ParseError.html +12 -0
  22. data/doc/rdoc/classes/LibXML/XML/Reader.html +421 -331
  23. data/doc/rdoc/classes/LibXML/XML/RelaxNG.html +237 -0
  24. data/doc/rdoc/classes/LibXML/XML/SaxParser.html +79 -60
  25. data/doc/rdoc/classes/LibXML/XML/Schema.html +109 -22
  26. data/doc/rdoc/classes/LibXML/XML/State.html +6 -0
  27. data/doc/rdoc/classes/LibXML/XML/XInclude.html +6 -0
  28. data/doc/rdoc/classes/LibXML/XML/XInclude/Error.html +6 -0
  29. data/doc/rdoc/classes/LibXML/XML/XPath.html +4 -48
  30. data/doc/rdoc/classes/LibXML/XML/XPath/Context.html +6 -5
  31. data/doc/rdoc/classes/LibXML/XML/XPath/InvalidPath.html +61 -0
  32. data/doc/rdoc/classes/LibXML/XML/XPath/Object.html +12 -8
  33. data/doc/rdoc/classes/LibXML/XML/XPointer.html +14 -8
  34. data/doc/rdoc/classes/LibXML/XML/XPointer/Context.html +6 -0
  35. data/doc/rdoc/classes/LibXML/XML/XPointer/Context/InvalidPath.html +6 -0
  36. data/doc/rdoc/classes/LibXML/XML/XPointer/InvalidExpression.html +13 -0
  37. data/doc/rdoc/created.rid +1 -1
  38. data/doc/rdoc/files/CHANGES.html +38 -10
  39. data/doc/rdoc/files/LICENSE.html +1 -1
  40. data/doc/rdoc/files/README.html +57 -23
  41. data/doc/rdoc/files/VERSION.html +1 -1
  42. data/doc/rdoc/files/ext/libxml/cbg_c.html +1 -1
  43. data/doc/rdoc/files/ext/libxml/libxml_c.html +1 -1
  44. data/doc/rdoc/files/ext/libxml/ruby_xml_attr_c.html +1 -1
  45. data/doc/rdoc/files/ext/libxml/ruby_xml_attributes_c.html +1 -1
  46. data/doc/rdoc/files/ext/libxml/ruby_xml_document_c.html +1 -1
  47. data/doc/rdoc/files/ext/libxml/ruby_xml_dtd_c.html +1 -1
  48. data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_c.html +1 -1
  49. data/doc/rdoc/files/ext/libxml/ruby_xml_input_cbg_c.html +1 -1
  50. data/doc/rdoc/files/ext/libxml/ruby_xml_node_c.html +1 -1
  51. data/doc/rdoc/files/ext/libxml/ruby_xml_node_set_c.html +1 -1
  52. data/doc/rdoc/files/ext/libxml/ruby_xml_ns_c.html +1 -1
  53. data/doc/rdoc/files/ext/libxml/ruby_xml_parser_c.html +1 -1
  54. data/doc/rdoc/files/ext/libxml/ruby_xml_parser_context_c.html +1 -1
  55. data/doc/rdoc/files/ext/libxml/ruby_xml_reader_c.html +1 -1
  56. data/doc/rdoc/{classes/XML.html → files/ext/libxml/ruby_xml_relaxng_c.html} +16 -35
  57. data/doc/rdoc/files/ext/libxml/ruby_xml_sax_parser_c.html +1 -1
  58. data/doc/rdoc/files/ext/libxml/ruby_xml_schema_c.html +1 -1
  59. data/doc/rdoc/files/ext/libxml/ruby_xml_state_c.html +1 -1
  60. data/doc/rdoc/files/ext/libxml/ruby_xml_xinclude_c.html +1 -1
  61. data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_c.html +1 -1
  62. data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_context_c.html +1 -1
  63. data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_object_c.html +1 -1
  64. data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_c.html +1 -1
  65. data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_context_c.html +1 -1
  66. data/doc/rdoc/files/lib/libxml/attr_rb.html +1 -1
  67. data/doc/rdoc/files/lib/libxml/attributes_rb.html +1 -1
  68. data/doc/rdoc/files/lib/libxml/document_rb.html +1 -1
  69. data/doc/rdoc/files/lib/libxml/node_rb.html +1 -1
  70. data/doc/rdoc/files/lib/libxml/node_set_rb.html +1 -1
  71. data/doc/rdoc/files/lib/libxml/parser_options_rb.html +1 -1
  72. data/doc/rdoc/files/lib/libxml/parser_rb.html +1 -1
  73. data/doc/rdoc/files/lib/libxml/properties_rb.html +1 -1
  74. data/doc/rdoc/files/lib/libxml/tree_rb.html +1 -1
  75. data/doc/rdoc/files/lib/libxml_rb.html +2 -2
  76. data/doc/rdoc/files/lib/xml/libxml_rb.html +12 -2
  77. data/doc/rdoc/files/lib/xml_rb.html +134 -0
  78. data/doc/rdoc/fr_class_index.html +1 -1
  79. data/doc/rdoc/fr_file_index.html +2 -0
  80. data/doc/rdoc/fr_method_index.html +349 -344
  81. data/ext/libxml/libxml.c +2 -1
  82. data/ext/libxml/ruby_libxml.h +1 -0
  83. data/ext/libxml/ruby_xml_attr.c +8 -2
  84. data/ext/libxml/ruby_xml_attributes.c +5 -5
  85. data/ext/libxml/ruby_xml_document.c +41 -2
  86. data/ext/libxml/ruby_xml_dtd.c +169 -169
  87. data/ext/libxml/ruby_xml_html_parser.c +449 -449
  88. data/ext/libxml/ruby_xml_input_cbg.c +165 -165
  89. data/ext/libxml/ruby_xml_node.c +1 -1
  90. data/ext/libxml/ruby_xml_node_set.c +172 -172
  91. data/ext/libxml/ruby_xml_ns.c +145 -145
  92. data/ext/libxml/ruby_xml_parser.c +1398 -1398
  93. data/ext/libxml/ruby_xml_parser_context.c +697 -697
  94. data/ext/libxml/ruby_xml_reader.c +44 -0
  95. data/ext/libxml/ruby_xml_reader.h +14 -14
  96. data/ext/libxml/ruby_xml_relaxng.c +97 -0
  97. data/ext/libxml/ruby_xml_relaxng.h +15 -0
  98. data/ext/libxml/ruby_xml_sax_parser.c +486 -486
  99. data/ext/libxml/ruby_xml_schema.c +1 -1
  100. data/ext/libxml/ruby_xml_state.c +4 -4
  101. data/ext/libxml/ruby_xml_xinclude.c +21 -21
  102. data/ext/libxml/ruby_xml_xpath.c +89 -89
  103. data/ext/libxml/ruby_xml_xpath_context.c +283 -283
  104. data/ext/libxml/ruby_xml_xpath_object.c +5 -5
  105. data/ext/libxml/ruby_xml_xpointer.c +104 -104
  106. data/ext/libxml/ruby_xml_xpointer_context.c +22 -22
  107. data/ext/libxml/version.h +2 -2
  108. data/ext/libxml/version.h.rej +17 -0
  109. data/ext/mingw/Rakefile +41 -0
  110. data/{mingw → lib}/libiconv-2.dll +0 -0
  111. data/lib/libxml.rb +15 -4
  112. data/lib/libxml2-2.dll +0 -0
  113. data/lib/libxml_ruby.dll.a +0 -0
  114. data/lib/libxml_ruby.so +0 -0
  115. data/lib/xml.rb +14 -0
  116. data/lib/xml/libxml.rb +4 -1
  117. data/test/etc_doc_to_s.rb +1 -1
  118. data/test/ets_copy_bug.rb +1 -1
  119. data/test/ets_copy_bug3.rb +1 -1
  120. data/test/ets_doc_file.rb +1 -1
  121. data/test/ets_doc_to_s.rb +1 -1
  122. data/test/ets_node_gc.rb +1 -1
  123. data/test/ets_tsr.rb +1 -1
  124. data/test/model/shiporder.rnc +28 -0
  125. data/test/model/shiporder.rng +86 -0
  126. data/test/{tc_xml_attributes.rb → tc_attributes.rb} +1 -10
  127. data/test/{tc_xml_document.rb → tc_document.rb} +1 -1
  128. data/test/{tc_xml_document_write.rb → tc_document_write.rb} +1 -1
  129. data/test/{tc_xml_dtd.rb → tc_dtd.rb} +1 -1
  130. data/test/{tc_xml_html_parser.rb → tc_html_parser.rb} +1 -1
  131. data/test/{tc_xml_node.rb → tc_node.rb} +1 -1
  132. data/test/{tc_xml_node_attr.rb → tc_node_attr.rb} +1 -1
  133. data/test/{tc_xml_node_cdata.rb → tc_node_cdata.rb} +24 -5
  134. data/test/{tc_xml_node_comment.rb → tc_node_comment.rb} +1 -1
  135. data/test/{tc_xml_node_copy.rb → tc_node_copy.rb} +1 -1
  136. data/test/{tc_xml_node_edit.rb → tc_node_edit.rb} +1 -1
  137. data/test/{tc_xml_node_set.rb → tc_node_set.rb} +1 -1
  138. data/test/{tc_xml_node_set2.rb → tc_node_set2.rb} +1 -1
  139. data/test/{tc_xml_node_text.rb → tc_node_text.rb} +1 -1
  140. data/test/{tc_xml_node_xlink.rb → tc_node_xlink.rb} +2 -2
  141. data/test/{tc_xml_parser.rb → tc_parser.rb} +1 -1
  142. data/test/{tc_xml_parser_context.rb → tc_parser_context.rb} +1 -1
  143. data/test/{tc_xml_properties.rb → tc_properties.rb} +1 -7
  144. data/test/{tc_xml_reader.rb → tc_reader.rb} +1 -1
  145. data/test/tc_relaxng.rb +39 -0
  146. data/test/{tc_xml_sax_parser.rb → tc_sax_parser.rb} +1 -1
  147. data/test/{tc_xml_schema.rb → tc_schema.rb} +1 -1
  148. data/test/{tc_xml_traversal.rb → tc_traversal.rb} +1 -1
  149. data/test/{tc_xml_xinclude.rb → tc_xinclude.rb} +1 -1
  150. data/test/{tc_xml_xpath.rb → tc_xpath.rb} +1 -1
  151. data/test/{tc_xml_xpath_context.rb → tc_xpath_context.rb} +1 -1
  152. data/test/{tc_xml_xpointer.rb → tc_xpointer.rb} +1 -1
  153. data/test/test_suite.rb +26 -25
  154. metadata +103 -100
  155. data/benchmark/depixelate.rb +0 -632
  156. data/benchmark/hamlet.xml +0 -9055
  157. data/benchmark/sock_entries.xml +0 -507
  158. data/benchmark/throughput.rb +0 -39
  159. data/benchmark/xml_benchmarks.rb +0 -227
  160. data/mingw/libxml2-2.dll +0 -0
  161. data/mingw/libxml_ruby.so +0 -0
  162. data/test/gc.log +0 -0
  163. data/vc/libxml_ruby.sln +0 -20
  164. data/vc/libxml_ruby.vcproj +0 -389
@@ -1,165 +1,165 @@
1
-
2
- /* ruby support for custom scheme handlers */
3
- /* Author: Martin Povolny (xpovolny@fi.muni.cz) */
4
-
5
- #include "ruby_libxml.h"
6
- #include "ruby_xml_input_cbg.h"
7
-
8
- static ic_scheme *first_scheme = 0;
9
-
10
- int ic_match (char const *filename) {
11
- ic_scheme *scheme;
12
-
13
- //fprintf( stderr, "ic_match: %s\n", filename );
14
-
15
- scheme = first_scheme;
16
- while (0 != scheme) {
17
- if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST scheme->scheme_name, scheme->name_len)) {
18
- return 1;
19
- }
20
- scheme = scheme->next_scheme;
21
- }
22
- return 0;
23
- }
24
-
25
- void* ic_open (char const *filename) {
26
- ic_doc_context *ic_doc;
27
- ic_scheme *scheme;
28
- VALUE res;
29
-
30
- scheme = first_scheme;
31
- while (0 != scheme) {
32
- if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST scheme->scheme_name, scheme->name_len)) {
33
- ic_doc = (ic_doc_context*)malloc( sizeof(ic_doc_context) );
34
-
35
- res = rb_funcall( scheme->class,
36
- rb_intern("document_query"),
37
- 1,
38
- rb_str_new2(filename) );
39
-
40
- ic_doc->buffer = strdup( StringValuePtr(res) );
41
-
42
- ic_doc->bpos = ic_doc->buffer;
43
- ic_doc->remaining = strlen(ic_doc->buffer);
44
- return ic_doc;
45
- }
46
- scheme = scheme->next_scheme;
47
- }
48
- return 0;
49
- }
50
-
51
- int ic_read (void *context, char *buffer, int len) {
52
- ic_doc_context *ic_doc;
53
- int ret_len;
54
- ic_doc = (ic_doc_context*)context;
55
-
56
- if (len >= ic_doc->remaining) {
57
- ret_len = ic_doc->remaining;
58
- } else {
59
- ret_len = len;
60
- }
61
- ic_doc->remaining -= ret_len;
62
- strncpy( buffer, ic_doc->bpos, ret_len );
63
- ic_doc->bpos += ret_len;
64
-
65
- return ret_len;
66
- }
67
-
68
- int ic_close (void *context) {
69
- ruby_xfree( ((ic_doc_context*)context)->buffer );
70
- ruby_xfree( context );
71
- return 1;
72
- }
73
-
74
- /*
75
- * call-seq:
76
- * register
77
- *
78
- * Register a new set of I/O callback for handling parser input.
79
- */
80
- VALUE input_callbacks_register_input_callbacks() {
81
- xmlRegisterInputCallbacks( ic_match, ic_open, ic_read, ic_close );
82
- return(Qtrue);
83
- }
84
-
85
- VALUE
86
- input_callbacks_add_scheme (VALUE self, VALUE scheme_name, VALUE class) {
87
- ic_scheme *scheme;
88
-
89
- Check_Type(scheme_name, T_STRING);
90
-
91
- scheme = (ic_scheme*)malloc(sizeof(ic_scheme));
92
- scheme->next_scheme = 0;
93
- scheme->scheme_name = strdup(StringValuePtr(scheme_name)); /* TODO alloc, dealloc */
94
- scheme->name_len = strlen(scheme->scheme_name);
95
- scheme->class = class; /* TODO alloc, dealloc */
96
-
97
- //fprintf( stderr, "registered: %s, %d, %s\n", scheme->scheme_name, scheme->name_len, scheme->class );
98
-
99
- if (0 == first_scheme)
100
- first_scheme = scheme;
101
- else {
102
- ic_scheme *pos;
103
- pos = first_scheme;
104
- while (0 != pos->next_scheme)
105
- pos = pos->next_scheme;
106
- pos->next_scheme = scheme;
107
- }
108
-
109
- return(Qtrue);
110
- }
111
-
112
- VALUE
113
- input_callbacks_remove_scheme (VALUE self, VALUE scheme_name) {
114
- char *name;
115
- ic_scheme *save_scheme, *scheme;
116
-
117
- Check_Type(scheme_name, T_STRING);
118
- name = StringValuePtr(scheme_name);
119
-
120
- if (0 == first_scheme)
121
- return Qfalse;
122
-
123
- /* check the first one */
124
- if (!strncmp(name, first_scheme->scheme_name, first_scheme->name_len)) {
125
- save_scheme = first_scheme->next_scheme;
126
-
127
- ruby_xfree(first_scheme->scheme_name);
128
- ruby_xfree(first_scheme);
129
-
130
- first_scheme = save_scheme;
131
- return Qtrue;
132
- }
133
-
134
- scheme = first_scheme;
135
- while (0 != scheme->next_scheme) {
136
- if ( !strncmp( name, scheme->next_scheme->scheme_name, scheme->next_scheme->name_len ) ) {
137
- save_scheme = scheme->next_scheme->next_scheme;
138
-
139
- ruby_xfree(scheme->next_scheme->scheme_name);
140
- ruby_xfree(scheme->next_scheme);
141
-
142
- scheme->next_scheme = save_scheme;
143
- return Qtrue;
144
- }
145
- scheme = scheme->next_scheme;
146
- }
147
- return Qfalse;
148
- }
149
-
150
- // Rdoc needs to know
151
- #ifdef RDOC_NEVER_DEFINED
152
- mLibXML = rb_define_module("LibXML");
153
- mXML = rb_define_module_under(mLibXML, "XML");
154
- #endif
155
-
156
- void
157
- ruby_init_input_callbacks(void) {
158
- VALUE cInputCallbacks;
159
- cInputCallbacks = rb_define_class_under(mXML, "InputCallbacks", rb_cObject);
160
-
161
- /* Class Methods */
162
- rb_define_singleton_method(cInputCallbacks, "register", input_callbacks_register_input_callbacks, 0);
163
- rb_define_singleton_method(cInputCallbacks, "add_scheme", input_callbacks_add_scheme, 2);
164
- rb_define_singleton_method(cInputCallbacks, "remove_scheme", input_callbacks_remove_scheme, 1);
165
- }
1
+
2
+ /* ruby support for custom scheme handlers */
3
+ /* Author: Martin Povolny (xpovolny@fi.muni.cz) */
4
+
5
+ #include "ruby_libxml.h"
6
+ #include "ruby_xml_input_cbg.h"
7
+
8
+ static ic_scheme *first_scheme = 0;
9
+
10
+ int ic_match (char const *filename) {
11
+ ic_scheme *scheme;
12
+
13
+ //fprintf( stderr, "ic_match: %s\n", filename );
14
+
15
+ scheme = first_scheme;
16
+ while (0 != scheme) {
17
+ if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST scheme->scheme_name, scheme->name_len)) {
18
+ return 1;
19
+ }
20
+ scheme = scheme->next_scheme;
21
+ }
22
+ return 0;
23
+ }
24
+
25
+ void* ic_open (char const *filename) {
26
+ ic_doc_context *ic_doc;
27
+ ic_scheme *scheme;
28
+ VALUE res;
29
+
30
+ scheme = first_scheme;
31
+ while (0 != scheme) {
32
+ if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST scheme->scheme_name, scheme->name_len)) {
33
+ ic_doc = (ic_doc_context*)malloc( sizeof(ic_doc_context) );
34
+
35
+ res = rb_funcall( scheme->class,
36
+ rb_intern("document_query"),
37
+ 1,
38
+ rb_str_new2(filename) );
39
+
40
+ ic_doc->buffer = strdup( StringValuePtr(res) );
41
+
42
+ ic_doc->bpos = ic_doc->buffer;
43
+ ic_doc->remaining = strlen(ic_doc->buffer);
44
+ return ic_doc;
45
+ }
46
+ scheme = scheme->next_scheme;
47
+ }
48
+ return 0;
49
+ }
50
+
51
+ int ic_read (void *context, char *buffer, int len) {
52
+ ic_doc_context *ic_doc;
53
+ int ret_len;
54
+ ic_doc = (ic_doc_context*)context;
55
+
56
+ if (len >= ic_doc->remaining) {
57
+ ret_len = ic_doc->remaining;
58
+ } else {
59
+ ret_len = len;
60
+ }
61
+ ic_doc->remaining -= ret_len;
62
+ strncpy( buffer, ic_doc->bpos, ret_len );
63
+ ic_doc->bpos += ret_len;
64
+
65
+ return ret_len;
66
+ }
67
+
68
+ int ic_close (void *context) {
69
+ ruby_xfree( ((ic_doc_context*)context)->buffer );
70
+ ruby_xfree( context );
71
+ return 1;
72
+ }
73
+
74
+ /*
75
+ * call-seq:
76
+ * register
77
+ *
78
+ * Register a new set of I/O callback for handling parser input.
79
+ */
80
+ VALUE input_callbacks_register_input_callbacks() {
81
+ xmlRegisterInputCallbacks( ic_match, ic_open, ic_read, ic_close );
82
+ return(Qtrue);
83
+ }
84
+
85
+ VALUE
86
+ input_callbacks_add_scheme (VALUE self, VALUE scheme_name, VALUE class) {
87
+ ic_scheme *scheme;
88
+
89
+ Check_Type(scheme_name, T_STRING);
90
+
91
+ scheme = (ic_scheme*)malloc(sizeof(ic_scheme));
92
+ scheme->next_scheme = 0;
93
+ scheme->scheme_name = strdup(StringValuePtr(scheme_name)); /* TODO alloc, dealloc */
94
+ scheme->name_len = strlen(scheme->scheme_name);
95
+ scheme->class = class; /* TODO alloc, dealloc */
96
+
97
+ //fprintf( stderr, "registered: %s, %d, %s\n", scheme->scheme_name, scheme->name_len, scheme->class );
98
+
99
+ if (0 == first_scheme)
100
+ first_scheme = scheme;
101
+ else {
102
+ ic_scheme *pos;
103
+ pos = first_scheme;
104
+ while (0 != pos->next_scheme)
105
+ pos = pos->next_scheme;
106
+ pos->next_scheme = scheme;
107
+ }
108
+
109
+ return(Qtrue);
110
+ }
111
+
112
+ VALUE
113
+ input_callbacks_remove_scheme (VALUE self, VALUE scheme_name) {
114
+ char *name;
115
+ ic_scheme *save_scheme, *scheme;
116
+
117
+ Check_Type(scheme_name, T_STRING);
118
+ name = StringValuePtr(scheme_name);
119
+
120
+ if (0 == first_scheme)
121
+ return Qfalse;
122
+
123
+ /* check the first one */
124
+ if (!strncmp(name, first_scheme->scheme_name, first_scheme->name_len)) {
125
+ save_scheme = first_scheme->next_scheme;
126
+
127
+ ruby_xfree(first_scheme->scheme_name);
128
+ ruby_xfree(first_scheme);
129
+
130
+ first_scheme = save_scheme;
131
+ return Qtrue;
132
+ }
133
+
134
+ scheme = first_scheme;
135
+ while (0 != scheme->next_scheme) {
136
+ if ( !strncmp( name, scheme->next_scheme->scheme_name, scheme->next_scheme->name_len ) ) {
137
+ save_scheme = scheme->next_scheme->next_scheme;
138
+
139
+ ruby_xfree(scheme->next_scheme->scheme_name);
140
+ ruby_xfree(scheme->next_scheme);
141
+
142
+ scheme->next_scheme = save_scheme;
143
+ return Qtrue;
144
+ }
145
+ scheme = scheme->next_scheme;
146
+ }
147
+ return Qfalse;
148
+ }
149
+
150
+ // Rdoc needs to know
151
+ #ifdef RDOC_NEVER_DEFINED
152
+ mLibXML = rb_define_module("LibXML");
153
+ mXML = rb_define_module_under(mLibXML, "XML");
154
+ #endif
155
+
156
+ void
157
+ ruby_init_input_callbacks(void) {
158
+ VALUE cInputCallbacks;
159
+ cInputCallbacks = rb_define_class_under(mXML, "InputCallbacks", rb_cObject);
160
+
161
+ /* Class Methods */
162
+ rb_define_singleton_method(cInputCallbacks, "register", input_callbacks_register_input_callbacks, 0);
163
+ rb_define_singleton_method(cInputCallbacks, "add_scheme", input_callbacks_add_scheme, 2);
164
+ rb_define_singleton_method(cInputCallbacks, "remove_scheme", input_callbacks_remove_scheme, 1);
165
+ }
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_node.c 461 2008-07-15 21:35:56Z cfis $ */
1
+ /* $Id: ruby_xml_node.c 497 2008-07-22 01:33:51Z cfis $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -1,172 +1,172 @@
1
- /* $Id: ruby_xml_node_set.c 461 2008-07-15 21:35:56Z cfis $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #include "ruby_libxml.h"
6
- #include "ruby_xml_node_set.h"
7
-
8
- /*
9
- * Document-class: LibXML::XML::Node::Set
10
- *
11
- * Includes Enumerable.
12
- */
13
- VALUE cXMLNodeSet;
14
-
15
- // TODO maybe we should support [] on nodeset?
16
- // Would also give us on xpath too...
17
-
18
- /*
19
- * call-seq:
20
- * nodeset.to_a -> [node, ..., node]
21
- *
22
- * Obtain an array of the nodes in this set.
23
- */
24
- VALUE
25
- ruby_xml_node_set_to_a(VALUE self) {
26
- ruby_xml_node_set *rxnset;
27
- VALUE r;
28
-
29
- Data_Get_Struct(self, ruby_xml_node_set, rxnset);
30
- r=ruby_xml_xpath_object_to_a(rxnset->rxpop);
31
- #ifdef NODE_DEBUG
32
- fprintf(stderr,"node_set_to_a %s\n",rb_str2cstr(rb_ary_to_s(r),0));
33
- #endif
34
- return r;
35
- }
36
-
37
-
38
- /*
39
- * call-seq:
40
- * nodeset.each { |node| ... } -> self
41
- *
42
- * Call the supplied block for each node in this set.
43
- */
44
- VALUE
45
- ruby_xml_node_set_each(VALUE self) {
46
- ruby_xml_node_set *rxnset;
47
-
48
- Data_Get_Struct(self, ruby_xml_node_set, rxnset);
49
- return ruby_xml_xpath_object_each(rxnset->rxpop);
50
- }
51
-
52
-
53
- /*
54
- * call-seq:
55
- * nodeset.empty? -> (true|false)
56
- *
57
- * Determine whether this nodeset is empty (contains no nodes).
58
- */
59
- VALUE
60
- ruby_xml_node_set_empty_q(VALUE self) {
61
- ruby_xml_node_set *rxnset;
62
-
63
- Data_Get_Struct(self, ruby_xml_node_set, rxnset);
64
- return ruby_xml_xpath_object_empty_q(rxnset->rxpop);
65
- }
66
-
67
-
68
- /*
69
- * call-seq:
70
- * nodeset.first -> node
71
- *
72
- * Returns the first node in this node set, or nil if none exist.
73
- */
74
- VALUE
75
- ruby_xml_node_set_first(VALUE self) {
76
- ruby_xml_node_set *rxnset;
77
-
78
- Data_Get_Struct(self, ruby_xml_node_set, rxnset);
79
- return ruby_xml_xpath_object_first(rxnset->rxpop);
80
- }
81
-
82
- /*
83
- * call-seq:
84
- * nodeset.length -> num
85
- *
86
- * Obtain the length of this nodeset.
87
- */
88
- VALUE
89
- ruby_xml_node_set_length(VALUE self) {
90
- ruby_xml_node_set *rxnset;
91
-
92
- Data_Get_Struct(self, ruby_xml_node_set, rxnset);
93
- return ruby_xml_xpath_object_length(rxnset->rxpop);
94
- }
95
-
96
-
97
- static void
98
- ruby_xml_node_set_mark(ruby_xml_node_set *rxnset) {
99
- if (!NIL_P(rxnset->rxpop))
100
- rb_gc_mark(rxnset->rxpop);
101
- }
102
-
103
- static void
104
- ruby_xml_node_set_free(ruby_xml_node_set *rxnset) {
105
- ruby_xfree(rxnset);
106
- }
107
-
108
- VALUE
109
- ruby_xml_node_set_new(VALUE class, VALUE rxpop)
110
- {
111
- ruby_xml_node_set *rxnset;
112
- rxnset = ALLOC(ruby_xml_node_set);
113
- rxnset->rxpop=rxpop;
114
- return Data_Wrap_Struct(class,
115
- ruby_xml_node_set_mark,
116
- ruby_xml_node_set_free,
117
- rxnset);
118
- }
119
-
120
- VALUE
121
- ruby_xml_node_set_new2(VALUE rxpop)
122
- {
123
- return ruby_xml_node_set_new(cXMLNodeSet,rxpop);
124
- }
125
-
126
- /*
127
- * call-seq:
128
- * nodeset.xpath -> xpath
129
- *
130
- * Obtain the xpath corresponding to this nodeset, if any.
131
- */
132
- VALUE
133
- ruby_xml_node_set_xpath_get(VALUE self) {
134
- rb_raise(rb_eRuntimeError,"xpath retrival is no longer supported");
135
- }
136
-
137
-
138
- /*
139
- * call-seq:
140
- * nodeset.xpath_ctxt -> context
141
- *
142
- * Return the xpath context corresponding to this nodeset,
143
- * if any.
144
- */
145
- VALUE
146
- ruby_xml_node_set_xpath_data_get(VALUE self) {
147
- rb_raise(rb_eRuntimeError,"xpath data retrival is no longer supported");
148
- }
149
-
150
- // Rdoc needs to know
151
- #ifdef RDOC_NEVER_DEFINED
152
- mLibXML = rb_define_module("LibXML");
153
- mXML = rb_define_module_under(mLibXML, "XML");
154
- cXMLNode = rb_define_class_under(mXML, "Node", rb_cObject);
155
- #endif
156
-
157
- void
158
- ruby_init_xml_node_set(void) {
159
- cXMLNodeSet = rb_define_class_under(cXMLNode, "Set", rb_cObject);
160
- rb_include_module(cXMLNodeSet, rb_mEnumerable);
161
-
162
- rb_define_method(cXMLNodeSet, "each", ruby_xml_node_set_each, 0);
163
- rb_define_method(cXMLNodeSet, "empty?", ruby_xml_node_set_empty_q, 0);
164
- rb_define_method(cXMLNodeSet, "first", ruby_xml_node_set_first, 0);
165
- rb_define_method(cXMLNodeSet, "length", ruby_xml_node_set_length, 0);
166
- rb_define_method(cXMLNodeSet, "size", ruby_xml_node_set_length, 0);
167
- rb_define_method(cXMLNodeSet, "to_a", ruby_xml_node_set_to_a, 0);
168
- rb_define_method(cXMLNodeSet, "xpath", ruby_xml_node_set_xpath_get, 0);
169
- rb_define_method(cXMLNodeSet, "xpath_ctxt",
170
- ruby_xml_node_set_xpath_data_get, 0);
171
-
172
- }
1
+ /* $Id: ruby_xml_node_set.c 461 2008-07-15 21:35:56Z cfis $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #include "ruby_libxml.h"
6
+ #include "ruby_xml_node_set.h"
7
+
8
+ /*
9
+ * Document-class: LibXML::XML::Node::Set
10
+ *
11
+ * Includes Enumerable.
12
+ */
13
+ VALUE cXMLNodeSet;
14
+
15
+ // TODO maybe we should support [] on nodeset?
16
+ // Would also give us on xpath too...
17
+
18
+ /*
19
+ * call-seq:
20
+ * nodeset.to_a -> [node, ..., node]
21
+ *
22
+ * Obtain an array of the nodes in this set.
23
+ */
24
+ VALUE
25
+ ruby_xml_node_set_to_a(VALUE self) {
26
+ ruby_xml_node_set *rxnset;
27
+ VALUE r;
28
+
29
+ Data_Get_Struct(self, ruby_xml_node_set, rxnset);
30
+ r=ruby_xml_xpath_object_to_a(rxnset->rxpop);
31
+ #ifdef NODE_DEBUG
32
+ fprintf(stderr,"node_set_to_a %s\n",rb_str2cstr(rb_ary_to_s(r),0));
33
+ #endif
34
+ return r;
35
+ }
36
+
37
+
38
+ /*
39
+ * call-seq:
40
+ * nodeset.each { |node| ... } -> self
41
+ *
42
+ * Call the supplied block for each node in this set.
43
+ */
44
+ VALUE
45
+ ruby_xml_node_set_each(VALUE self) {
46
+ ruby_xml_node_set *rxnset;
47
+
48
+ Data_Get_Struct(self, ruby_xml_node_set, rxnset);
49
+ return ruby_xml_xpath_object_each(rxnset->rxpop);
50
+ }
51
+
52
+
53
+ /*
54
+ * call-seq:
55
+ * nodeset.empty? -> (true|false)
56
+ *
57
+ * Determine whether this nodeset is empty (contains no nodes).
58
+ */
59
+ VALUE
60
+ ruby_xml_node_set_empty_q(VALUE self) {
61
+ ruby_xml_node_set *rxnset;
62
+
63
+ Data_Get_Struct(self, ruby_xml_node_set, rxnset);
64
+ return ruby_xml_xpath_object_empty_q(rxnset->rxpop);
65
+ }
66
+
67
+
68
+ /*
69
+ * call-seq:
70
+ * nodeset.first -> node
71
+ *
72
+ * Returns the first node in this node set, or nil if none exist.
73
+ */
74
+ VALUE
75
+ ruby_xml_node_set_first(VALUE self) {
76
+ ruby_xml_node_set *rxnset;
77
+
78
+ Data_Get_Struct(self, ruby_xml_node_set, rxnset);
79
+ return ruby_xml_xpath_object_first(rxnset->rxpop);
80
+ }
81
+
82
+ /*
83
+ * call-seq:
84
+ * nodeset.length -> num
85
+ *
86
+ * Obtain the length of this nodeset.
87
+ */
88
+ VALUE
89
+ ruby_xml_node_set_length(VALUE self) {
90
+ ruby_xml_node_set *rxnset;
91
+
92
+ Data_Get_Struct(self, ruby_xml_node_set, rxnset);
93
+ return ruby_xml_xpath_object_length(rxnset->rxpop);
94
+ }
95
+
96
+
97
+ static void
98
+ ruby_xml_node_set_mark(ruby_xml_node_set *rxnset) {
99
+ if (!NIL_P(rxnset->rxpop))
100
+ rb_gc_mark(rxnset->rxpop);
101
+ }
102
+
103
+ static void
104
+ ruby_xml_node_set_free(ruby_xml_node_set *rxnset) {
105
+ ruby_xfree(rxnset);
106
+ }
107
+
108
+ VALUE
109
+ ruby_xml_node_set_new(VALUE class, VALUE rxpop)
110
+ {
111
+ ruby_xml_node_set *rxnset;
112
+ rxnset = ALLOC(ruby_xml_node_set);
113
+ rxnset->rxpop=rxpop;
114
+ return Data_Wrap_Struct(class,
115
+ ruby_xml_node_set_mark,
116
+ ruby_xml_node_set_free,
117
+ rxnset);
118
+ }
119
+
120
+ VALUE
121
+ ruby_xml_node_set_new2(VALUE rxpop)
122
+ {
123
+ return ruby_xml_node_set_new(cXMLNodeSet,rxpop);
124
+ }
125
+
126
+ /*
127
+ * call-seq:
128
+ * nodeset.xpath -> xpath
129
+ *
130
+ * Obtain the xpath corresponding to this nodeset, if any.
131
+ */
132
+ VALUE
133
+ ruby_xml_node_set_xpath_get(VALUE self) {
134
+ rb_raise(rb_eRuntimeError,"xpath retrival is no longer supported");
135
+ }
136
+
137
+
138
+ /*
139
+ * call-seq:
140
+ * nodeset.xpath_ctxt -> context
141
+ *
142
+ * Return the xpath context corresponding to this nodeset,
143
+ * if any.
144
+ */
145
+ VALUE
146
+ ruby_xml_node_set_xpath_data_get(VALUE self) {
147
+ rb_raise(rb_eRuntimeError,"xpath data retrival is no longer supported");
148
+ }
149
+
150
+ // Rdoc needs to know
151
+ #ifdef RDOC_NEVER_DEFINED
152
+ mLibXML = rb_define_module("LibXML");
153
+ mXML = rb_define_module_under(mLibXML, "XML");
154
+ cXMLNode = rb_define_class_under(mXML, "Node", rb_cObject);
155
+ #endif
156
+
157
+ void
158
+ ruby_init_xml_node_set(void) {
159
+ cXMLNodeSet = rb_define_class_under(cXMLNode, "Set", rb_cObject);
160
+ rb_include_module(cXMLNodeSet, rb_mEnumerable);
161
+
162
+ rb_define_method(cXMLNodeSet, "each", ruby_xml_node_set_each, 0);
163
+ rb_define_method(cXMLNodeSet, "empty?", ruby_xml_node_set_empty_q, 0);
164
+ rb_define_method(cXMLNodeSet, "first", ruby_xml_node_set_first, 0);
165
+ rb_define_method(cXMLNodeSet, "length", ruby_xml_node_set_length, 0);
166
+ rb_define_method(cXMLNodeSet, "size", ruby_xml_node_set_length, 0);
167
+ rb_define_method(cXMLNodeSet, "to_a", ruby_xml_node_set_to_a, 0);
168
+ rb_define_method(cXMLNodeSet, "xpath", ruby_xml_node_set_xpath_get, 0);
169
+ rb_define_method(cXMLNodeSet, "xpath_ctxt",
170
+ ruby_xml_node_set_xpath_data_get, 0);
171
+
172
+ }