libxml-ruby 2.7.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/HISTORY +33 -11
- data/README.rdoc +7 -7
- data/Rakefile +80 -77
- data/ext/libxml/extconf.h +4 -5
- data/ext/libxml/extconf.rb +57 -118
- data/ext/libxml/libxml.c +4 -0
- data/ext/libxml/ruby_xml.c +977 -893
- data/ext/libxml/ruby_xml.h +20 -10
- data/ext/libxml/ruby_xml_attr.c +333 -333
- data/ext/libxml/ruby_xml_attr_decl.c +2 -2
- data/ext/libxml/ruby_xml_cbg.c +85 -85
- data/ext/libxml/ruby_xml_document.c +1133 -1147
- data/ext/libxml/ruby_xml_dtd.c +261 -268
- data/ext/libxml/ruby_xml_encoding.c +262 -260
- data/ext/libxml/ruby_xml_encoding.h +19 -19
- data/ext/libxml/ruby_xml_html_parser_context.c +337 -338
- data/ext/libxml/ruby_xml_input_cbg.c +191 -191
- data/ext/libxml/ruby_xml_io.c +52 -50
- data/ext/libxml/ruby_xml_namespace.c +2 -2
- data/ext/libxml/ruby_xml_node.c +1446 -1452
- data/ext/libxml/ruby_xml_parser_context.c +999 -1001
- data/ext/libxml/ruby_xml_reader.c +1226 -1228
- data/ext/libxml/ruby_xml_relaxng.c +110 -111
- data/ext/libxml/ruby_xml_sax2_handler.c +326 -328
- data/ext/libxml/ruby_xml_schema.c +300 -301
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/ext/libxml/ruby_xml_writer.c +34 -16
- data/ext/libxml/ruby_xml_xpath.c +188 -187
- data/ext/libxml/ruby_xml_xpath_context.c +360 -361
- data/ext/libxml/ruby_xml_xpath_object.c +335 -335
- data/libxml-ruby.gemspec +47 -44
- data/test/tc_attr.rb +5 -7
- data/test/tc_attr_decl.rb +5 -6
- data/test/tc_attributes.rb +1 -2
- data/test/tc_canonicalize.rb +1 -2
- data/test/tc_deprecated_require.rb +1 -2
- data/test/tc_document.rb +4 -5
- data/test/tc_document_write.rb +2 -3
- data/test/tc_dtd.rb +4 -5
- data/test/tc_encoding.rb +126 -126
- data/test/tc_encoding_sax.rb +4 -3
- data/test/tc_error.rb +14 -15
- data/test/tc_html_parser.rb +15 -7
- data/test/tc_html_parser_context.rb +1 -2
- data/test/tc_namespace.rb +2 -3
- data/test/tc_namespaces.rb +5 -6
- data/test/tc_node.rb +2 -3
- data/test/tc_node_cdata.rb +2 -3
- data/test/tc_node_comment.rb +1 -2
- data/test/tc_node_copy.rb +1 -2
- data/test/tc_node_edit.rb +5 -7
- data/test/tc_node_pi.rb +1 -2
- data/test/tc_node_text.rb +2 -3
- data/test/tc_node_write.rb +2 -3
- data/test/tc_node_xlink.rb +1 -2
- data/test/tc_parser.rb +18 -24
- data/test/tc_parser_context.rb +6 -7
- data/test/tc_properties.rb +1 -2
- data/test/tc_reader.rb +9 -10
- data/test/tc_relaxng.rb +4 -5
- data/test/tc_sax_parser.rb +9 -10
- data/test/tc_schema.rb +4 -5
- data/test/tc_traversal.rb +1 -2
- data/test/tc_writer.rb +1 -2
- data/test/tc_xinclude.rb +1 -2
- data/test/tc_xml.rb +1 -2
- data/test/tc_xpath.rb +8 -9
- data/test/tc_xpath_context.rb +3 -4
- data/test/tc_xpath_expression.rb +3 -4
- data/test/tc_xpointer.rb +1 -3
- data/test/test_helper.rb +3 -1
- data/test/test_suite.rb +0 -1
- metadata +90 -72
- data/test/etc_doc_to_s.rb +0 -21
- data/test/ets_doc_file.rb +0 -17
- data/test/ets_doc_to_s.rb +0 -23
- data/test/ets_gpx.rb +0 -28
- data/test/ets_node_gc.rb +0 -23
- data/test/ets_test.xml +0 -2
- data/test/ets_tsr.rb +0 -11
- data/test/model/kml_sample.xml +0 -915
- data/test/remove_test.rb +0 -9
- data/test/tc_gc.rb +0 -86
- data/test/tc_parser.rb.orig +0 -384
@@ -1,191 +1,191 @@
|
|
1
|
-
/* Author: Martin Povolny (xpovolny@fi.muni.cz) */
|
2
|
-
|
3
|
-
#include "ruby_libxml.h"
|
4
|
-
#include "ruby_xml_input_cbg.h"
|
5
|
-
|
6
|
-
/* Document-class: LibXML::XML::InputCallbacks
|
7
|
-
*
|
8
|
-
* Support for adding custom scheme handlers. */
|
9
|
-
|
10
|
-
static ic_scheme *first_scheme = 0;
|
11
|
-
|
12
|
-
int ic_match(char const *filename)
|
13
|
-
{
|
14
|
-
ic_scheme *scheme;
|
15
|
-
|
16
|
-
//fprintf( stderr, "ic_match: %s\n", filename );
|
17
|
-
|
18
|
-
scheme = first_scheme;
|
19
|
-
while (0 != scheme)
|
20
|
-
{
|
21
|
-
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST scheme->scheme_name, scheme->name_len))
|
22
|
-
{
|
23
|
-
return 1;
|
24
|
-
}
|
25
|
-
scheme = scheme->next_scheme;
|
26
|
-
}
|
27
|
-
return 0;
|
28
|
-
}
|
29
|
-
|
30
|
-
void* ic_open(char const *filename)
|
31
|
-
{
|
32
|
-
ic_doc_context *ic_doc;
|
33
|
-
ic_scheme *scheme;
|
34
|
-
VALUE res;
|
35
|
-
|
36
|
-
scheme = first_scheme;
|
37
|
-
while (0 != scheme)
|
38
|
-
{
|
39
|
-
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST scheme->scheme_name, scheme->name_len))
|
40
|
-
{
|
41
|
-
ic_doc = (ic_doc_context*) malloc(sizeof(ic_doc_context));
|
42
|
-
|
43
|
-
res = rb_funcall(scheme->class, rb_intern("document_query"), 1,
|
44
|
-
rb_str_new2(filename));
|
45
|
-
|
46
|
-
ic_doc->buffer = strdup(StringValuePtr(res));
|
47
|
-
|
48
|
-
ic_doc->bpos = ic_doc->buffer;
|
49
|
-
ic_doc->remaining = strlen(ic_doc->buffer);
|
50
|
-
return ic_doc;
|
51
|
-
}
|
52
|
-
scheme = scheme->next_scheme;
|
53
|
-
}
|
54
|
-
return 0;
|
55
|
-
}
|
56
|
-
|
57
|
-
int ic_read(void *context, char *buffer, int len)
|
58
|
-
{
|
59
|
-
ic_doc_context *ic_doc;
|
60
|
-
int ret_len;
|
61
|
-
ic_doc = (ic_doc_context*) context;
|
62
|
-
|
63
|
-
if (len >= ic_doc->remaining)
|
64
|
-
{
|
65
|
-
ret_len = ic_doc->remaining;
|
66
|
-
}
|
67
|
-
else
|
68
|
-
{
|
69
|
-
ret_len = len;
|
70
|
-
}
|
71
|
-
ic_doc->remaining -= ret_len;
|
72
|
-
strncpy(buffer, ic_doc->bpos, ret_len);
|
73
|
-
ic_doc->bpos += ret_len;
|
74
|
-
|
75
|
-
return ret_len;
|
76
|
-
}
|
77
|
-
|
78
|
-
int ic_close(void *context)
|
79
|
-
{
|
80
|
-
ruby_xfree(((ic_doc_context*) context)->buffer);
|
81
|
-
ruby_xfree(context);
|
82
|
-
return 1;
|
83
|
-
}
|
84
|
-
|
85
|
-
/*
|
86
|
-
* call-seq:
|
87
|
-
* register
|
88
|
-
*
|
89
|
-
* Register a new set of I/O callback for handling parser input.
|
90
|
-
*/
|
91
|
-
static VALUE input_callbacks_register_input_callbacks()
|
92
|
-
{
|
93
|
-
xmlRegisterInputCallbacks(ic_match, ic_open, ic_read, ic_close);
|
94
|
-
return (Qtrue);
|
95
|
-
}
|
96
|
-
|
97
|
-
/*
|
98
|
-
* call-seq:
|
99
|
-
* add_scheme
|
100
|
-
*
|
101
|
-
* No documentation available.
|
102
|
-
*/
|
103
|
-
static VALUE input_callbacks_add_scheme(VALUE self, VALUE scheme_name,
|
104
|
-
VALUE class)
|
105
|
-
{
|
106
|
-
ic_scheme *scheme;
|
107
|
-
|
108
|
-
Check_Type(scheme_name, T_STRING);
|
109
|
-
|
110
|
-
scheme = (ic_scheme*) malloc(sizeof(ic_scheme));
|
111
|
-
scheme->next_scheme = 0;
|
112
|
-
scheme->scheme_name = strdup(StringValuePtr(scheme_name)); /* TODO alloc, dealloc */
|
113
|
-
scheme->name_len = strlen(scheme->scheme_name);
|
114
|
-
scheme->class = class; /* TODO alloc, dealloc */
|
115
|
-
|
116
|
-
//fprintf( stderr, "registered: %s, %d, %s\n", scheme->scheme_name, scheme->name_len, scheme->class );
|
117
|
-
|
118
|
-
if (0 == first_scheme)
|
119
|
-
first_scheme = scheme;
|
120
|
-
else
|
121
|
-
{
|
122
|
-
ic_scheme *pos;
|
123
|
-
pos = first_scheme;
|
124
|
-
while (0 != pos->next_scheme)
|
125
|
-
pos = pos->next_scheme;
|
126
|
-
pos->next_scheme = scheme;
|
127
|
-
}
|
128
|
-
|
129
|
-
return (Qtrue);
|
130
|
-
}
|
131
|
-
|
132
|
-
/*
|
133
|
-
* call-seq:
|
134
|
-
* remove_scheme
|
135
|
-
*
|
136
|
-
* No documentation available.
|
137
|
-
*/
|
138
|
-
static VALUE input_callbacks_remove_scheme(VALUE self, VALUE scheme_name)
|
139
|
-
{
|
140
|
-
char *name;
|
141
|
-
ic_scheme *save_scheme, *scheme;
|
142
|
-
|
143
|
-
Check_Type(scheme_name, T_STRING);
|
144
|
-
name = StringValuePtr(scheme_name);
|
145
|
-
|
146
|
-
if (0 == first_scheme)
|
147
|
-
return Qfalse;
|
148
|
-
|
149
|
-
if (!strncmp(name, first_scheme->scheme_name, first_scheme->name_len))
|
150
|
-
{
|
151
|
-
save_scheme = first_scheme->next_scheme;
|
152
|
-
|
153
|
-
ruby_xfree(first_scheme->scheme_name);
|
154
|
-
ruby_xfree(first_scheme);
|
155
|
-
|
156
|
-
first_scheme = save_scheme;
|
157
|
-
return Qtrue;
|
158
|
-
}
|
159
|
-
|
160
|
-
scheme = first_scheme;
|
161
|
-
while (0 != scheme->next_scheme)
|
162
|
-
{
|
163
|
-
if (!strncmp(name, scheme->next_scheme->scheme_name,
|
164
|
-
scheme->next_scheme->name_len))
|
165
|
-
{
|
166
|
-
save_scheme = scheme->next_scheme->next_scheme;
|
167
|
-
|
168
|
-
ruby_xfree(scheme->next_scheme->scheme_name);
|
169
|
-
ruby_xfree(scheme->next_scheme);
|
170
|
-
|
171
|
-
scheme->next_scheme = save_scheme;
|
172
|
-
return Qtrue;
|
173
|
-
}
|
174
|
-
scheme = scheme->next_scheme;
|
175
|
-
}
|
176
|
-
return Qfalse;
|
177
|
-
}
|
178
|
-
|
179
|
-
void rxml_init_input_callbacks(void)
|
180
|
-
{
|
181
|
-
VALUE cInputCallbacks;
|
182
|
-
cInputCallbacks = rb_define_class_under(mXML, "InputCallbacks", rb_cObject);
|
183
|
-
|
184
|
-
/* Class Methods */
|
185
|
-
rb_define_singleton_method(cInputCallbacks, "register",
|
186
|
-
input_callbacks_register_input_callbacks, 0);
|
187
|
-
rb_define_singleton_method(cInputCallbacks, "add_scheme",
|
188
|
-
input_callbacks_add_scheme, 2);
|
189
|
-
rb_define_singleton_method(cInputCallbacks, "remove_scheme",
|
190
|
-
input_callbacks_remove_scheme, 1);
|
191
|
-
}
|
1
|
+
/* Author: Martin Povolny (xpovolny@fi.muni.cz) */
|
2
|
+
|
3
|
+
#include "ruby_libxml.h"
|
4
|
+
#include "ruby_xml_input_cbg.h"
|
5
|
+
|
6
|
+
/* Document-class: LibXML::XML::InputCallbacks
|
7
|
+
*
|
8
|
+
* Support for adding custom scheme handlers. */
|
9
|
+
|
10
|
+
static ic_scheme *first_scheme = 0;
|
11
|
+
|
12
|
+
int ic_match(char const *filename)
|
13
|
+
{
|
14
|
+
ic_scheme *scheme;
|
15
|
+
|
16
|
+
//fprintf( stderr, "ic_match: %s\n", filename );
|
17
|
+
|
18
|
+
scheme = first_scheme;
|
19
|
+
while (0 != scheme)
|
20
|
+
{
|
21
|
+
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST scheme->scheme_name, scheme->name_len))
|
22
|
+
{
|
23
|
+
return 1;
|
24
|
+
}
|
25
|
+
scheme = scheme->next_scheme;
|
26
|
+
}
|
27
|
+
return 0;
|
28
|
+
}
|
29
|
+
|
30
|
+
void* ic_open(char const *filename)
|
31
|
+
{
|
32
|
+
ic_doc_context *ic_doc;
|
33
|
+
ic_scheme *scheme;
|
34
|
+
VALUE res;
|
35
|
+
|
36
|
+
scheme = first_scheme;
|
37
|
+
while (0 != scheme)
|
38
|
+
{
|
39
|
+
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST scheme->scheme_name, scheme->name_len))
|
40
|
+
{
|
41
|
+
ic_doc = (ic_doc_context*) malloc(sizeof(ic_doc_context));
|
42
|
+
|
43
|
+
res = rb_funcall(scheme->class, rb_intern("document_query"), 1,
|
44
|
+
rb_str_new2(filename));
|
45
|
+
|
46
|
+
ic_doc->buffer = strdup(StringValuePtr(res));
|
47
|
+
|
48
|
+
ic_doc->bpos = ic_doc->buffer;
|
49
|
+
ic_doc->remaining = (int)strlen(ic_doc->buffer);
|
50
|
+
return ic_doc;
|
51
|
+
}
|
52
|
+
scheme = scheme->next_scheme;
|
53
|
+
}
|
54
|
+
return 0;
|
55
|
+
}
|
56
|
+
|
57
|
+
int ic_read(void *context, char *buffer, int len)
|
58
|
+
{
|
59
|
+
ic_doc_context *ic_doc;
|
60
|
+
int ret_len;
|
61
|
+
ic_doc = (ic_doc_context*) context;
|
62
|
+
|
63
|
+
if (len >= ic_doc->remaining)
|
64
|
+
{
|
65
|
+
ret_len = ic_doc->remaining;
|
66
|
+
}
|
67
|
+
else
|
68
|
+
{
|
69
|
+
ret_len = len;
|
70
|
+
}
|
71
|
+
ic_doc->remaining -= ret_len;
|
72
|
+
strncpy(buffer, ic_doc->bpos, ret_len);
|
73
|
+
ic_doc->bpos += ret_len;
|
74
|
+
|
75
|
+
return ret_len;
|
76
|
+
}
|
77
|
+
|
78
|
+
int ic_close(void *context)
|
79
|
+
{
|
80
|
+
ruby_xfree(((ic_doc_context*) context)->buffer);
|
81
|
+
ruby_xfree(context);
|
82
|
+
return 1;
|
83
|
+
}
|
84
|
+
|
85
|
+
/*
|
86
|
+
* call-seq:
|
87
|
+
* register
|
88
|
+
*
|
89
|
+
* Register a new set of I/O callback for handling parser input.
|
90
|
+
*/
|
91
|
+
static VALUE input_callbacks_register_input_callbacks()
|
92
|
+
{
|
93
|
+
xmlRegisterInputCallbacks(ic_match, ic_open, ic_read, ic_close);
|
94
|
+
return (Qtrue);
|
95
|
+
}
|
96
|
+
|
97
|
+
/*
|
98
|
+
* call-seq:
|
99
|
+
* add_scheme
|
100
|
+
*
|
101
|
+
* No documentation available.
|
102
|
+
*/
|
103
|
+
static VALUE input_callbacks_add_scheme(VALUE self, VALUE scheme_name,
|
104
|
+
VALUE class)
|
105
|
+
{
|
106
|
+
ic_scheme *scheme;
|
107
|
+
|
108
|
+
Check_Type(scheme_name, T_STRING);
|
109
|
+
|
110
|
+
scheme = (ic_scheme*) malloc(sizeof(ic_scheme));
|
111
|
+
scheme->next_scheme = 0;
|
112
|
+
scheme->scheme_name = strdup(StringValuePtr(scheme_name)); /* TODO alloc, dealloc */
|
113
|
+
scheme->name_len = (int)strlen(scheme->scheme_name);
|
114
|
+
scheme->class = class; /* TODO alloc, dealloc */
|
115
|
+
|
116
|
+
//fprintf( stderr, "registered: %s, %d, %s\n", scheme->scheme_name, scheme->name_len, scheme->class );
|
117
|
+
|
118
|
+
if (0 == first_scheme)
|
119
|
+
first_scheme = scheme;
|
120
|
+
else
|
121
|
+
{
|
122
|
+
ic_scheme *pos;
|
123
|
+
pos = first_scheme;
|
124
|
+
while (0 != pos->next_scheme)
|
125
|
+
pos = pos->next_scheme;
|
126
|
+
pos->next_scheme = scheme;
|
127
|
+
}
|
128
|
+
|
129
|
+
return (Qtrue);
|
130
|
+
}
|
131
|
+
|
132
|
+
/*
|
133
|
+
* call-seq:
|
134
|
+
* remove_scheme
|
135
|
+
*
|
136
|
+
* No documentation available.
|
137
|
+
*/
|
138
|
+
static VALUE input_callbacks_remove_scheme(VALUE self, VALUE scheme_name)
|
139
|
+
{
|
140
|
+
char *name;
|
141
|
+
ic_scheme *save_scheme, *scheme;
|
142
|
+
|
143
|
+
Check_Type(scheme_name, T_STRING);
|
144
|
+
name = StringValuePtr(scheme_name);
|
145
|
+
|
146
|
+
if (0 == first_scheme)
|
147
|
+
return Qfalse;
|
148
|
+
|
149
|
+
if (!strncmp(name, first_scheme->scheme_name, first_scheme->name_len))
|
150
|
+
{
|
151
|
+
save_scheme = first_scheme->next_scheme;
|
152
|
+
|
153
|
+
ruby_xfree(first_scheme->scheme_name);
|
154
|
+
ruby_xfree(first_scheme);
|
155
|
+
|
156
|
+
first_scheme = save_scheme;
|
157
|
+
return Qtrue;
|
158
|
+
}
|
159
|
+
|
160
|
+
scheme = first_scheme;
|
161
|
+
while (0 != scheme->next_scheme)
|
162
|
+
{
|
163
|
+
if (!strncmp(name, scheme->next_scheme->scheme_name,
|
164
|
+
scheme->next_scheme->name_len))
|
165
|
+
{
|
166
|
+
save_scheme = scheme->next_scheme->next_scheme;
|
167
|
+
|
168
|
+
ruby_xfree(scheme->next_scheme->scheme_name);
|
169
|
+
ruby_xfree(scheme->next_scheme);
|
170
|
+
|
171
|
+
scheme->next_scheme = save_scheme;
|
172
|
+
return Qtrue;
|
173
|
+
}
|
174
|
+
scheme = scheme->next_scheme;
|
175
|
+
}
|
176
|
+
return Qfalse;
|
177
|
+
}
|
178
|
+
|
179
|
+
void rxml_init_input_callbacks(void)
|
180
|
+
{
|
181
|
+
VALUE cInputCallbacks;
|
182
|
+
cInputCallbacks = rb_define_class_under(mXML, "InputCallbacks", rb_cObject);
|
183
|
+
|
184
|
+
/* Class Methods */
|
185
|
+
rb_define_singleton_method(cInputCallbacks, "register",
|
186
|
+
input_callbacks_register_input_callbacks, 0);
|
187
|
+
rb_define_singleton_method(cInputCallbacks, "add_scheme",
|
188
|
+
input_callbacks_add_scheme, 2);
|
189
|
+
rb_define_singleton_method(cInputCallbacks, "remove_scheme",
|
190
|
+
input_callbacks_remove_scheme, 1);
|
191
|
+
}
|
data/ext/libxml/ruby_xml_io.c
CHANGED
@@ -1,50 +1,52 @@
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
-
|
3
|
-
#include "extconf.h"
|
4
|
-
#include "ruby_libxml.h"
|
5
|
-
|
6
|
-
static ID READ_METHOD;
|
7
|
-
#
|
8
|
-
|
9
|
-
#
|
10
|
-
|
11
|
-
/*
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
io
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
return
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
#
|
50
|
-
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
+
|
3
|
+
#include "extconf.h"
|
4
|
+
#include "ruby_libxml.h"
|
5
|
+
|
6
|
+
static ID READ_METHOD;
|
7
|
+
#ifdef HAVE_RB_IO_BUFWRITE
|
8
|
+
#include <ruby/io.h>
|
9
|
+
#else
|
10
|
+
static ID WRITE_METHOD;
|
11
|
+
#endif /* !HAVE_RB_IO_BUFWRITE */
|
12
|
+
|
13
|
+
/* This method is called by libxml when it wants to read
|
14
|
+
more data from a stream. We go with the duck typing
|
15
|
+
solution to support StringIO objects. */
|
16
|
+
int rxml_read_callback(void *context, char *buffer, int len)
|
17
|
+
{
|
18
|
+
VALUE io = (VALUE) context;
|
19
|
+
VALUE string = rb_funcall(io, READ_METHOD, 1, INT2NUM(len));
|
20
|
+
size_t size;
|
21
|
+
|
22
|
+
if (string == Qnil)
|
23
|
+
return 0;
|
24
|
+
|
25
|
+
size = RSTRING_LEN(string);
|
26
|
+
memcpy(buffer, StringValuePtr(string), size);
|
27
|
+
|
28
|
+
return (int)size;
|
29
|
+
}
|
30
|
+
|
31
|
+
int rxml_write_callback(void *context, const char *buffer, int len)
|
32
|
+
{
|
33
|
+
#ifndef HAVE_RB_IO_BUFWRITE
|
34
|
+
VALUE io, written, string;
|
35
|
+
|
36
|
+
io = (VALUE) context;
|
37
|
+
string = rb_str_new(buffer, len);
|
38
|
+
written = rb_funcall(io, WRITE_METHOD, 1, string);
|
39
|
+
|
40
|
+
return NUM2INT(written);
|
41
|
+
#else
|
42
|
+
return (int)rb_io_bufwrite((VALUE) context, buffer, (size_t)len);
|
43
|
+
#endif /* !HAVE_RB_IO_BUFWRITE */
|
44
|
+
}
|
45
|
+
|
46
|
+
void rxml_init_io(void)
|
47
|
+
{
|
48
|
+
READ_METHOD = rb_intern("read");
|
49
|
+
#ifndef HAVE_RB_IO_BUFWRITE
|
50
|
+
WRITE_METHOD = rb_intern("write");
|
51
|
+
#endif /* !HAVE_RB_IO_BUFWRITE */
|
52
|
+
}
|
@@ -81,7 +81,7 @@ static VALUE rxml_namespace_href_get(VALUE self)
|
|
81
81
|
if (xns->href == NULL)
|
82
82
|
return Qnil;
|
83
83
|
else
|
84
|
-
return rxml_new_cstr(
|
84
|
+
return rxml_new_cstr( xns->href, NULL);
|
85
85
|
}
|
86
86
|
|
87
87
|
/*
|
@@ -116,7 +116,7 @@ static VALUE rxml_namespace_prefix_get(VALUE self)
|
|
116
116
|
if (xns->prefix == NULL)
|
117
117
|
return Qnil;
|
118
118
|
else
|
119
|
-
return rxml_new_cstr(
|
119
|
+
return rxml_new_cstr( xns->prefix, NULL);
|
120
120
|
}
|
121
121
|
|
122
122
|
/*
|