libxml-ruby 0.9.2-x86-mswin32-60 → 0.9.3-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +13 -0
- data/ext/libxml/libxml.c +885 -886
- data/ext/libxml/ruby_libxml.h +70 -72
- data/ext/libxml/ruby_xml_attr.c +76 -76
- data/ext/libxml/ruby_xml_attr.h +8 -8
- data/ext/libxml/ruby_xml_attributes.c +36 -36
- data/ext/libxml/ruby_xml_attributes.h +6 -6
- data/ext/libxml/ruby_xml_document.c +133 -220
- data/ext/libxml/ruby_xml_document.h +4 -7
- data/ext/libxml/ruby_xml_dtd.c +30 -109
- data/ext/libxml/ruby_xml_dtd.h +2 -11
- data/ext/libxml/ruby_xml_error.c +10 -10
- data/ext/libxml/ruby_xml_error.h +4 -4
- data/ext/libxml/ruby_xml_html_parser.c +28 -40
- data/ext/libxml/ruby_xml_html_parser.h +4 -4
- data/ext/libxml/ruby_xml_input.c +208 -32
- data/ext/libxml/ruby_xml_input.h +7 -5
- data/ext/libxml/ruby_xml_input_cbg.c +3 -3
- data/ext/libxml/ruby_xml_node.c +217 -217
- data/ext/libxml/ruby_xml_node.h +5 -5
- data/ext/libxml/ruby_xml_ns.c +26 -26
- data/ext/libxml/ruby_xml_ns.h +4 -4
- data/ext/libxml/ruby_xml_parser.c +151 -164
- data/ext/libxml/ruby_xml_parser.h +3 -8
- data/ext/libxml/ruby_xml_parser_context.c +105 -105
- data/ext/libxml/ruby_xml_parser_context.h +4 -4
- data/ext/libxml/ruby_xml_reader.c +145 -162
- data/ext/libxml/ruby_xml_reader.h +4 -4
- data/ext/libxml/ruby_xml_relaxng.c +30 -43
- data/ext/libxml/ruby_xml_relaxng.h +2 -7
- data/ext/libxml/ruby_xml_sax_parser.c +174 -228
- data/ext/libxml/ruby_xml_sax_parser.h +12 -20
- data/ext/libxml/ruby_xml_schema.c +31 -44
- data/ext/libxml/ruby_xml_schema.h +2 -7
- data/ext/libxml/ruby_xml_state.c +6 -6
- data/ext/libxml/ruby_xml_state.h +2 -2
- data/ext/libxml/ruby_xml_xinclude.c +1 -1
- data/ext/libxml/ruby_xml_xinclude.h +3 -3
- data/ext/libxml/ruby_xml_xpath.c +1 -1
- data/ext/libxml/ruby_xml_xpath.h +3 -12
- data/ext/libxml/ruby_xml_xpath_context.c +293 -294
- data/ext/libxml/ruby_xml_xpath_context.h +3 -7
- data/ext/libxml/ruby_xml_xpath_expression.c +11 -11
- data/ext/libxml/ruby_xml_xpath_expression.h +2 -2
- data/ext/libxml/ruby_xml_xpath_object.c +52 -66
- data/ext/libxml/ruby_xml_xpath_object.h +3 -14
- data/ext/libxml/ruby_xml_xpointer.c +11 -12
- data/ext/libxml/ruby_xml_xpointer.h +5 -7
- data/ext/libxml/sax_parser_callbacks.inc +53 -36
- data/ext/libxml/version.h +2 -2
- data/ext/mingw/libxml_ruby.dll.a +0 -0
- data/ext/mingw/libxml_ruby.so +0 -0
- data/ext/vc/libxml_ruby.vcproj +1 -9
- data/lib/libxml/html_parser.rb +5 -5
- data/lib/libxml/parser.rb +4 -4
- data/lib/libxml/sax_parser.rb +24 -0
- data/test/tc_document_write.rb +2 -16
- data/test/tc_html_parser.rb +57 -5
- data/test/tc_input.rb +13 -0
- data/test/tc_parser.rb +11 -3
- data/test/tc_reader.rb +53 -34
- data/test/tc_sax_parser.rb +30 -8
- data/test/test.rb +8 -0
- data/test/test_suite.rb +1 -1
- metadata +5 -6
- data/ext/libxml/ruby_xml_encoding.c +0 -164
- data/ext/libxml/ruby_xml_encoding.h +0 -13
- data/test/tc_encoding.rb +0 -13
@@ -1,13 +1,13 @@
|
|
1
|
-
/* $Id: ruby_xml_parser_context.h
|
1
|
+
/* $Id: ruby_xml_parser_context.h 612 2008-11-21 08:01:29Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
5
|
-
#ifndef
|
6
|
-
#define
|
5
|
+
#ifndef __rxml_PARSER_CONTEXT__
|
6
|
+
#define __rxml_PARSER_CONTEXT__
|
7
7
|
|
8
8
|
extern VALUE cXMLParserContext;
|
9
9
|
|
10
10
|
void ruby_init_xml_parser_context(void);
|
11
|
-
VALUE
|
11
|
+
VALUE rxml_parser_context_wrap(xmlParserCtxtPtr ctxt);
|
12
12
|
|
13
13
|
#endif
|
@@ -56,19 +56,15 @@ __rb_str_new_and_free(xmlChar *x)
|
|
56
56
|
|
57
57
|
#define CSTR2RVAL2(x) (__rb_str_new_and_free(x))
|
58
58
|
|
59
|
-
static int
|
60
|
-
ctxtRead(FILE *f, char * buf, size_t len) {
|
61
|
-
return(fread(buf, 1, len, f));
|
62
|
-
}
|
63
59
|
|
64
60
|
static VALUE
|
65
|
-
|
61
|
+
rxml_reader_new(VALUE class, xmlTextReaderPtr reader)
|
66
62
|
{
|
67
63
|
return Data_Wrap_Struct(class, NULL, xmlFreeTextReader, reader);
|
68
64
|
}
|
69
65
|
|
70
66
|
static xmlTextReaderPtr
|
71
|
-
|
67
|
+
rxml_text_reader_get(VALUE obj)
|
72
68
|
{
|
73
69
|
xmlTextReaderPtr ptr;
|
74
70
|
Data_Get_Struct(obj, xmlTextReader, ptr);
|
@@ -83,7 +79,7 @@ ruby_xml_text_reader_get(VALUE obj)
|
|
83
79
|
* options are a combination of xmlParserOption.
|
84
80
|
*/
|
85
81
|
static VALUE
|
86
|
-
|
82
|
+
rxml_reader_new_file(int argc, VALUE *argv, VALUE self)
|
87
83
|
{
|
88
84
|
xmlTextReaderPtr reader;
|
89
85
|
VALUE path, encoding, options;
|
@@ -98,7 +94,7 @@ ruby_xml_reader_new_file(int argc, VALUE *argv, VALUE self)
|
|
98
94
|
"cannot create text reader for given XML file at path '%s'",
|
99
95
|
RVAL2CSTR(path));
|
100
96
|
|
101
|
-
return
|
97
|
+
return rxml_reader_new(self, reader);
|
102
98
|
}
|
103
99
|
|
104
100
|
/*
|
@@ -109,34 +105,21 @@ ruby_xml_reader_new_file(int argc, VALUE *argv, VALUE self)
|
|
109
105
|
* a combination of xmlParserOption.
|
110
106
|
*/
|
111
107
|
static VALUE
|
112
|
-
|
108
|
+
rxml_reader_new_io(int argc, VALUE *argv, VALUE self)
|
113
109
|
{
|
114
110
|
xmlTextReaderPtr reader;
|
115
111
|
VALUE io, url, encoding, options;
|
116
|
-
OpenFile *fptr;
|
117
|
-
FILE *f;
|
118
|
-
|
119
|
-
#ifdef _WIN32
|
120
|
-
rb_raise(rb_eRuntimeError, "Reading an io stream is not supported on Windows");
|
121
|
-
#endif
|
122
112
|
|
123
113
|
rb_scan_args(argc, argv, "13", &io, &url, &encoding, &options);
|
124
114
|
|
125
|
-
|
126
|
-
rb_raise(rb_eTypeError, "need an IO object");
|
127
|
-
|
128
|
-
GetOpenFile(io, fptr);
|
129
|
-
rb_io_check_readable(fptr);
|
130
|
-
f = GetWriteFile(fptr);
|
131
|
-
|
132
|
-
reader = xmlReaderForIO((xmlInputReadCallback) ctxtRead, NULL, f,
|
115
|
+
reader = xmlReaderForIO((xmlInputReadCallback) rxml_read_callback, NULL, io,
|
133
116
|
NIL_P(url) ? NULL : RVAL2CSTR(url),
|
134
117
|
NIL_P(encoding) ? NULL : RVAL2CSTR(encoding),
|
135
118
|
NIL_P(options) ? 0 : FIX2INT(options));
|
136
119
|
if (reader == NULL)
|
137
120
|
rb_raise(rb_eRuntimeError, "cannot create text reader for given stream");
|
138
121
|
|
139
|
-
return
|
122
|
+
return rxml_reader_new(self, reader);
|
140
123
|
}
|
141
124
|
|
142
125
|
/*
|
@@ -147,7 +130,7 @@ ruby_xml_reader_new_io(int argc, VALUE *argv, VALUE self)
|
|
147
130
|
* Create an XML text reader for a preparsed document.
|
148
131
|
*/
|
149
132
|
VALUE
|
150
|
-
|
133
|
+
rxml_reader_new_walker(VALUE self, VALUE doc)
|
151
134
|
{
|
152
135
|
xmlDocPtr xdoc;
|
153
136
|
xmlTextReaderPtr reader;
|
@@ -158,7 +141,7 @@ ruby_xml_reader_new_walker(VALUE self, VALUE doc)
|
|
158
141
|
if (reader == NULL)
|
159
142
|
rb_raise(rb_eRuntimeError, "cannot create text reader for given document");
|
160
143
|
|
161
|
-
return
|
144
|
+
return rxml_reader_new(self, reader);
|
162
145
|
}
|
163
146
|
|
164
147
|
/*
|
@@ -170,7 +153,7 @@ ruby_xml_reader_new_walker(VALUE self, VALUE doc)
|
|
170
153
|
* options are a combination of xmlParserOption.
|
171
154
|
*/
|
172
155
|
static VALUE
|
173
|
-
|
156
|
+
rxml_reader_new_data(int argc, VALUE *argv, VALUE self)
|
174
157
|
{
|
175
158
|
xmlTextReaderPtr reader;
|
176
159
|
VALUE data, url, encoding, options;
|
@@ -187,7 +170,7 @@ ruby_xml_reader_new_data(int argc, VALUE *argv, VALUE self)
|
|
187
170
|
if (reader == NULL)
|
188
171
|
rb_raise(rb_eRuntimeError, "cannot create text reader for given data");
|
189
172
|
|
190
|
-
return
|
173
|
+
return rxml_reader_new(self, reader);
|
191
174
|
}
|
192
175
|
|
193
176
|
/*
|
@@ -198,9 +181,9 @@ ruby_xml_reader_new_data(int argc, VALUE *argv, VALUE self)
|
|
198
181
|
* changes the state to Closed and close any underlying input.
|
199
182
|
*/
|
200
183
|
static VALUE
|
201
|
-
|
184
|
+
rxml_reader_close(VALUE self)
|
202
185
|
{
|
203
|
-
return INT2FIX(xmlTextReaderClose(
|
186
|
+
return INT2FIX(xmlTextReaderClose(rxml_text_reader_get(self)));
|
204
187
|
}
|
205
188
|
|
206
189
|
/*
|
@@ -212,12 +195,12 @@ ruby_xml_reader_close(VALUE self)
|
|
212
195
|
* relative to the containing element.
|
213
196
|
*/
|
214
197
|
static VALUE
|
215
|
-
|
198
|
+
rxml_reader_move_to_attr(VALUE self, VALUE val)
|
216
199
|
{
|
217
200
|
xmlTextReaderPtr reader;
|
218
201
|
int ret;
|
219
202
|
|
220
|
-
reader =
|
203
|
+
reader = rxml_text_reader_get(self);
|
221
204
|
|
222
205
|
if (TYPE(val) == T_FIXNUM) {
|
223
206
|
ret = xmlTextReaderMoveToAttributeNo(reader, FIX2INT(val));
|
@@ -237,9 +220,9 @@ ruby_xml_reader_move_to_attr(VALUE self, VALUE val)
|
|
237
220
|
* with the current node.
|
238
221
|
*/
|
239
222
|
static VALUE
|
240
|
-
|
223
|
+
rxml_reader_move_to_first_attr(VALUE self)
|
241
224
|
{
|
242
|
-
return INT2FIX(xmlTextReaderMoveToFirstAttribute(
|
225
|
+
return INT2FIX(xmlTextReaderMoveToFirstAttribute(rxml_text_reader_get(self)));
|
243
226
|
}
|
244
227
|
|
245
228
|
/*
|
@@ -250,9 +233,9 @@ ruby_xml_reader_move_to_first_attr(VALUE self)
|
|
250
233
|
* with the current node.
|
251
234
|
*/
|
252
235
|
static VALUE
|
253
|
-
|
236
|
+
rxml_reader_move_to_next_attr(VALUE self)
|
254
237
|
{
|
255
|
-
return INT2FIX(xmlTextReaderMoveToNextAttribute(
|
238
|
+
return INT2FIX(xmlTextReaderMoveToNextAttribute(rxml_text_reader_get(self)));
|
256
239
|
}
|
257
240
|
|
258
241
|
/*
|
@@ -263,9 +246,9 @@ ruby_xml_reader_move_to_next_attr(VALUE self)
|
|
263
246
|
* current attribute node.
|
264
247
|
*/
|
265
248
|
static VALUE
|
266
|
-
|
249
|
+
rxml_reader_move_to_element(VALUE self)
|
267
250
|
{
|
268
|
-
return INT2FIX(xmlTextReaderMoveToElement(
|
251
|
+
return INT2FIX(xmlTextReaderMoveToElement(rxml_text_reader_get(self)));
|
269
252
|
}
|
270
253
|
|
271
254
|
/*
|
@@ -276,9 +259,9 @@ ruby_xml_reader_move_to_element(VALUE self)
|
|
276
259
|
* the subtree if any.
|
277
260
|
*/
|
278
261
|
static VALUE
|
279
|
-
|
262
|
+
rxml_reader_next(VALUE self)
|
280
263
|
{
|
281
|
-
return INT2FIX(xmlTextReaderNext(
|
264
|
+
return INT2FIX(xmlTextReaderNext(rxml_text_reader_get(self)));
|
282
265
|
}
|
283
266
|
|
284
267
|
/*
|
@@ -290,9 +273,9 @@ ruby_xml_reader_next(VALUE self)
|
|
290
273
|
* document.
|
291
274
|
*/
|
292
275
|
static VALUE
|
293
|
-
|
276
|
+
rxml_reader_next_sibling(VALUE self)
|
294
277
|
{
|
295
|
-
return INT2FIX(xmlTextReaderNextSibling(
|
278
|
+
return INT2FIX(xmlTextReaderNextSibling(rxml_text_reader_get(self)));
|
296
279
|
}
|
297
280
|
|
298
281
|
/*
|
@@ -303,9 +286,9 @@ ruby_xml_reader_next_sibling(VALUE self)
|
|
303
286
|
* http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html
|
304
287
|
*/
|
305
288
|
static VALUE
|
306
|
-
|
289
|
+
rxml_reader_node_type(VALUE self)
|
307
290
|
{
|
308
|
-
return INT2FIX(xmlTextReaderNodeType(
|
291
|
+
return INT2FIX(xmlTextReaderNodeType(rxml_text_reader_get(self)));
|
309
292
|
}
|
310
293
|
|
311
294
|
/*
|
@@ -321,9 +304,9 @@ ruby_xml_reader_node_type(VALUE self)
|
|
321
304
|
* Return 1 or -1 in case of error.
|
322
305
|
*/
|
323
306
|
static VALUE
|
324
|
-
|
307
|
+
rxml_reader_normalization(VALUE self)
|
325
308
|
{
|
326
|
-
return INT2FIX(xmlTextReaderNormalization(
|
309
|
+
return INT2FIX(xmlTextReaderNormalization(rxml_text_reader_get(self)));
|
327
310
|
}
|
328
311
|
|
329
312
|
/*
|
@@ -337,9 +320,9 @@ ruby_xml_reader_normalization(VALUE self)
|
|
337
320
|
* read, or -1 in case of error.
|
338
321
|
*/
|
339
322
|
static VALUE
|
340
|
-
|
323
|
+
rxml_reader_read(VALUE self)
|
341
324
|
{
|
342
|
-
return INT2FIX(xmlTextReaderRead(
|
325
|
+
return INT2FIX(xmlTextReaderRead(rxml_text_reader_get(self)));
|
343
326
|
}
|
344
327
|
|
345
328
|
/*
|
@@ -353,9 +336,9 @@ ruby_xml_reader_read(VALUE self)
|
|
353
336
|
* error.
|
354
337
|
*/
|
355
338
|
static VALUE
|
356
|
-
|
339
|
+
rxml_reader_read_attr_value(VALUE self)
|
357
340
|
{
|
358
|
-
return INT2FIX(xmlTextReaderReadAttributeValue(
|
341
|
+
return INT2FIX(xmlTextReaderReadAttributeValue(rxml_text_reader_get(self)));
|
359
342
|
}
|
360
343
|
|
361
344
|
/*
|
@@ -368,9 +351,9 @@ ruby_xml_reader_read_attr_value(VALUE self)
|
|
368
351
|
* neither an element nor attribute, or has no child nodes.
|
369
352
|
*/
|
370
353
|
static VALUE
|
371
|
-
|
354
|
+
rxml_reader_read_inner_xml(VALUE self)
|
372
355
|
{
|
373
|
-
return CSTR2RVAL2(xmlTextReaderReadInnerXml(
|
356
|
+
return CSTR2RVAL2(xmlTextReaderReadInnerXml(rxml_text_reader_get(self)));
|
374
357
|
}
|
375
358
|
|
376
359
|
/*
|
@@ -383,9 +366,9 @@ ruby_xml_reader_read_inner_xml(VALUE self)
|
|
383
366
|
* neither an element nor attribute, or has no child nodes.
|
384
367
|
*/
|
385
368
|
static VALUE
|
386
|
-
|
369
|
+
rxml_reader_read_outer_xml(VALUE self)
|
387
370
|
{
|
388
|
-
return CSTR2RVAL2(xmlTextReaderReadOuterXml(
|
371
|
+
return CSTR2RVAL2(xmlTextReaderReadOuterXml(rxml_text_reader_get(self)));
|
389
372
|
}
|
390
373
|
|
391
374
|
/*
|
@@ -395,9 +378,9 @@ ruby_xml_reader_read_outer_xml(VALUE self)
|
|
395
378
|
* Get the read state of the reader.
|
396
379
|
*/
|
397
380
|
static VALUE
|
398
|
-
|
381
|
+
rxml_reader_read_state(VALUE self)
|
399
382
|
{
|
400
|
-
return INT2FIX(xmlTextReaderReadState(
|
383
|
+
return INT2FIX(xmlTextReaderReadState(rxml_text_reader_get(self)));
|
401
384
|
}
|
402
385
|
|
403
386
|
/*
|
@@ -410,9 +393,9 @@ ruby_xml_reader_read_state(VALUE self)
|
|
410
393
|
* if the reader is positioned on any other type of node.
|
411
394
|
*/
|
412
395
|
static VALUE
|
413
|
-
|
396
|
+
rxml_reader_read_string(VALUE self)
|
414
397
|
{
|
415
|
-
return CSTR2RVAL2(xmlTextReaderReadString(
|
398
|
+
return CSTR2RVAL2(xmlTextReaderReadString(rxml_text_reader_get(self)));
|
416
399
|
}
|
417
400
|
|
418
401
|
/*
|
@@ -427,9 +410,9 @@ ruby_xml_reader_read_string(VALUE self)
|
|
427
410
|
* case of error.
|
428
411
|
*/
|
429
412
|
static VALUE
|
430
|
-
|
413
|
+
rxml_reader_relax_ng_validate(VALUE self, VALUE rng)
|
431
414
|
{
|
432
|
-
return INT2FIX(xmlTextReaderRelaxNGValidate(
|
415
|
+
return INT2FIX(xmlTextReaderRelaxNGValidate(rxml_text_reader_get(self), NIL_P(rng) ? NULL : RVAL2CSTR(rng)));
|
433
416
|
}
|
434
417
|
|
435
418
|
#if LIBXML_VERSION >= 20620
|
@@ -445,9 +428,9 @@ ruby_xml_reader_relax_ng_validate(VALUE self, VALUE rng)
|
|
445
428
|
* case of error.
|
446
429
|
*/
|
447
430
|
static VALUE
|
448
|
-
|
431
|
+
rxml_reader_schema_validate(VALUE self, VALUE xsd)
|
449
432
|
{
|
450
|
-
return INT2FIX(xmlTextReaderSchemaValidate(
|
433
|
+
return INT2FIX(xmlTextReaderSchemaValidate(rxml_text_reader_get(self), NIL_P(xsd) ? NULL : RVAL2CSTR(xsd)));
|
451
434
|
}
|
452
435
|
#endif
|
453
436
|
|
@@ -458,9 +441,9 @@ ruby_xml_reader_schema_validate(VALUE self, VALUE xsd)
|
|
458
441
|
* Return the qualified name of the node.
|
459
442
|
*/
|
460
443
|
static VALUE
|
461
|
-
|
444
|
+
rxml_reader_name(VALUE self)
|
462
445
|
{
|
463
|
-
return CSTR2RVAL(xmlTextReaderConstName(
|
446
|
+
return CSTR2RVAL(xmlTextReaderConstName(rxml_text_reader_get(self)));
|
464
447
|
}
|
465
448
|
|
466
449
|
/*
|
@@ -470,9 +453,9 @@ ruby_xml_reader_name(VALUE self)
|
|
470
453
|
* Return the local name of the node.
|
471
454
|
*/
|
472
455
|
static VALUE
|
473
|
-
|
456
|
+
rxml_reader_local_name(VALUE self)
|
474
457
|
{
|
475
|
-
return CSTR2RVAL(xmlTextReaderConstLocalName(
|
458
|
+
return CSTR2RVAL(xmlTextReaderConstLocalName(rxml_text_reader_get(self)));
|
476
459
|
}
|
477
460
|
|
478
461
|
/*
|
@@ -482,9 +465,9 @@ ruby_xml_reader_local_name(VALUE self)
|
|
482
465
|
* Provide the number of attributes of the current node.
|
483
466
|
*/
|
484
467
|
static VALUE
|
485
|
-
|
468
|
+
rxml_reader_attr_count(VALUE self)
|
486
469
|
{
|
487
|
-
return INT2FIX(xmlTextReaderAttributeCount(
|
470
|
+
return INT2FIX(xmlTextReaderAttributeCount(rxml_text_reader_get(self)));
|
488
471
|
}
|
489
472
|
|
490
473
|
/*
|
@@ -494,9 +477,9 @@ ruby_xml_reader_attr_count(VALUE self)
|
|
494
477
|
* Determine the encoding of the document being read.
|
495
478
|
*/
|
496
479
|
static VALUE
|
497
|
-
|
480
|
+
rxml_reader_encoding(VALUE self)
|
498
481
|
{
|
499
|
-
return CSTR2RVAL(xmlTextReaderConstEncoding(
|
482
|
+
return CSTR2RVAL(xmlTextReaderConstEncoding(rxml_text_reader_get(self)));
|
500
483
|
}
|
501
484
|
|
502
485
|
/*
|
@@ -506,9 +489,9 @@ ruby_xml_reader_encoding(VALUE self)
|
|
506
489
|
* Determine the base URI of the node.
|
507
490
|
*/
|
508
491
|
static VALUE
|
509
|
-
|
492
|
+
rxml_reader_base_uri(VALUE self)
|
510
493
|
{
|
511
|
-
return CSTR2RVAL(xmlTextReaderConstBaseUri(
|
494
|
+
return CSTR2RVAL(xmlTextReaderConstBaseUri(rxml_text_reader_get(self)));
|
512
495
|
}
|
513
496
|
|
514
497
|
/*
|
@@ -518,9 +501,9 @@ ruby_xml_reader_base_uri(VALUE self)
|
|
518
501
|
* Determine the namespace URI of the node.
|
519
502
|
*/
|
520
503
|
static VALUE
|
521
|
-
|
504
|
+
rxml_reader_namespace_uri(VALUE self)
|
522
505
|
{
|
523
|
-
return CSTR2RVAL(xmlTextReaderConstNamespaceUri(
|
506
|
+
return CSTR2RVAL(xmlTextReaderConstNamespaceUri(rxml_text_reader_get(self)));
|
524
507
|
}
|
525
508
|
|
526
509
|
/*
|
@@ -530,9 +513,9 @@ ruby_xml_reader_namespace_uri(VALUE self)
|
|
530
513
|
* Provide the text value of the node if present.
|
531
514
|
*/
|
532
515
|
static VALUE
|
533
|
-
|
516
|
+
rxml_reader_value(VALUE self)
|
534
517
|
{
|
535
|
-
return CSTR2RVAL(xmlTextReaderConstValue(
|
518
|
+
return CSTR2RVAL(xmlTextReaderConstValue(rxml_text_reader_get(self)));
|
536
519
|
}
|
537
520
|
|
538
521
|
/*
|
@@ -542,9 +525,9 @@ ruby_xml_reader_value(VALUE self)
|
|
542
525
|
* Get a shorthand reference to the namespace associated with the node.
|
543
526
|
*/
|
544
527
|
static VALUE
|
545
|
-
|
528
|
+
rxml_reader_prefix(VALUE self)
|
546
529
|
{
|
547
|
-
return CSTR2RVAL(xmlTextReaderConstPrefix(
|
530
|
+
return CSTR2RVAL(xmlTextReaderConstPrefix(rxml_text_reader_get(self)));
|
548
531
|
}
|
549
532
|
|
550
533
|
/*
|
@@ -554,9 +537,9 @@ ruby_xml_reader_prefix(VALUE self)
|
|
554
537
|
* Get the depth of the node in the tree.
|
555
538
|
*/
|
556
539
|
static VALUE
|
557
|
-
|
540
|
+
rxml_reader_depth(VALUE self)
|
558
541
|
{
|
559
|
-
return INT2FIX(xmlTextReaderDepth(
|
542
|
+
return INT2FIX(xmlTextReaderDepth(rxml_text_reader_get(self)));
|
560
543
|
}
|
561
544
|
|
562
545
|
/*
|
@@ -567,9 +550,9 @@ ruby_xml_reader_depth(VALUE self)
|
|
567
550
|
* as an integer value (and -1 in case of error).
|
568
551
|
*/
|
569
552
|
static VALUE
|
570
|
-
|
553
|
+
rxml_reader_quote_char(VALUE self)
|
571
554
|
{
|
572
|
-
return INT2FIX(xmlTextReaderQuoteChar(
|
555
|
+
return INT2FIX(xmlTextReaderQuoteChar(rxml_text_reader_get(self)));
|
573
556
|
}
|
574
557
|
|
575
558
|
/*
|
@@ -583,9 +566,9 @@ ruby_xml_reader_quote_char(VALUE self)
|
|
583
566
|
* standalone status or in case of error.
|
584
567
|
*/
|
585
568
|
static VALUE
|
586
|
-
|
569
|
+
rxml_reader_standalone(VALUE self)
|
587
570
|
{
|
588
|
-
return INT2FIX(xmlTextReaderStandalone(
|
571
|
+
return INT2FIX(xmlTextReaderStandalone(rxml_text_reader_get(self)));
|
589
572
|
}
|
590
573
|
|
591
574
|
/*
|
@@ -595,9 +578,9 @@ ruby_xml_reader_standalone(VALUE self)
|
|
595
578
|
* Get the xml:lang scope within which the node resides.
|
596
579
|
*/
|
597
580
|
static VALUE
|
598
|
-
|
581
|
+
rxml_reader_xml_lang(VALUE self)
|
599
582
|
{
|
600
|
-
return CSTR2RVAL(xmlTextReaderConstXmlLang(
|
583
|
+
return CSTR2RVAL(xmlTextReaderConstXmlLang(rxml_text_reader_get(self)));
|
601
584
|
}
|
602
585
|
|
603
586
|
/*
|
@@ -607,9 +590,9 @@ ruby_xml_reader_xml_lang(VALUE self)
|
|
607
590
|
* Determine the XML version of the document being read.
|
608
591
|
*/
|
609
592
|
static VALUE
|
610
|
-
|
593
|
+
rxml_reader_xml_version(VALUE self)
|
611
594
|
{
|
612
|
-
return CSTR2RVAL(xmlTextReaderConstXmlVersion(
|
595
|
+
return CSTR2RVAL(xmlTextReaderConstXmlVersion(rxml_text_reader_get(self)));
|
613
596
|
}
|
614
597
|
|
615
598
|
/*
|
@@ -619,9 +602,9 @@ ruby_xml_reader_xml_version(VALUE self)
|
|
619
602
|
* Get whether the node has attributes.
|
620
603
|
*/
|
621
604
|
static VALUE
|
622
|
-
|
605
|
+
rxml_reader_has_attributes(VALUE self)
|
623
606
|
{
|
624
|
-
return xmlTextReaderHasAttributes(
|
607
|
+
return xmlTextReaderHasAttributes(rxml_text_reader_get(self)) ? Qtrue : Qfalse;
|
625
608
|
}
|
626
609
|
|
627
610
|
/*
|
@@ -631,9 +614,9 @@ ruby_xml_reader_has_attributes(VALUE self)
|
|
631
614
|
* Get whether the node can have a text value.
|
632
615
|
*/
|
633
616
|
static VALUE
|
634
|
-
|
617
|
+
rxml_reader_has_value(VALUE self)
|
635
618
|
{
|
636
|
-
return xmlTextReaderHasValue(
|
619
|
+
return xmlTextReaderHasValue(rxml_text_reader_get(self)) ? Qtrue : Qfalse;
|
637
620
|
}
|
638
621
|
|
639
622
|
/*
|
@@ -645,12 +628,12 @@ ruby_xml_reader_has_value(VALUE self)
|
|
645
628
|
* containing element, as a string.
|
646
629
|
*/
|
647
630
|
static VALUE
|
648
|
-
|
631
|
+
rxml_reader_attribute(VALUE self, VALUE key)
|
649
632
|
{
|
650
633
|
xmlTextReaderPtr reader;
|
651
634
|
xmlChar *attr;
|
652
635
|
|
653
|
-
reader =
|
636
|
+
reader = rxml_text_reader_get(self);
|
654
637
|
|
655
638
|
if (TYPE(key) == T_FIXNUM) {
|
656
639
|
attr = xmlTextReaderGetAttributeNo(reader, FIX2INT(key));
|
@@ -669,9 +652,9 @@ ruby_xml_reader_attribute(VALUE self, VALUE key)
|
|
669
652
|
* To return the default namespace, specify nil as +prefix+.
|
670
653
|
*/
|
671
654
|
static VALUE
|
672
|
-
|
655
|
+
rxml_reader_lookup_namespace(VALUE self, VALUE prefix)
|
673
656
|
{
|
674
|
-
return CSTR2RVAL2(xmlTextReaderLookupNamespace(
|
657
|
+
return CSTR2RVAL2(xmlTextReaderLookupNamespace(rxml_text_reader_get(self), (const xmlChar *)RVAL2CSTR(prefix)));
|
675
658
|
}
|
676
659
|
|
677
660
|
/*
|
@@ -684,11 +667,11 @@ ruby_xml_reader_lookup_namespace(VALUE self, VALUE prefix)
|
|
684
667
|
* Return an XML::Node object, or nil in case of error.
|
685
668
|
*/
|
686
669
|
static VALUE
|
687
|
-
|
670
|
+
rxml_reader_expand(VALUE self)
|
688
671
|
{
|
689
672
|
xmlNodePtr node;
|
690
673
|
xmlDocPtr doc;
|
691
|
-
xmlTextReaderPtr reader =
|
674
|
+
xmlTextReaderPtr reader = rxml_text_reader_get(self);
|
692
675
|
node = xmlTextReaderExpand(reader);
|
693
676
|
|
694
677
|
if (!node)
|
@@ -702,9 +685,9 @@ ruby_xml_reader_expand(VALUE self)
|
|
702
685
|
|
703
686
|
xmlTextReaderPreserve(reader);
|
704
687
|
doc = xmlTextReaderCurrentDoc(reader);
|
705
|
-
|
688
|
+
rxml_document_wrap(doc);
|
706
689
|
|
707
|
-
return
|
690
|
+
return rxml_node2_wrap(cXMLNode, node);
|
708
691
|
}
|
709
692
|
|
710
693
|
#if LIBXML_VERSION >= 20618
|
@@ -716,9 +699,9 @@ ruby_xml_reader_expand(VALUE self)
|
|
716
699
|
* relative to the start of the current entity.
|
717
700
|
*/
|
718
701
|
static VALUE
|
719
|
-
|
702
|
+
rxml_reader_byte_consumed(VALUE self)
|
720
703
|
{
|
721
|
-
return INT2NUM(xmlTextReaderByteConsumed(
|
704
|
+
return INT2NUM(xmlTextReaderByteConsumed(rxml_text_reader_get(self)));
|
722
705
|
}
|
723
706
|
#endif
|
724
707
|
|
@@ -730,9 +713,9 @@ ruby_xml_reader_byte_consumed(VALUE self)
|
|
730
713
|
* Provide the column number of the current parsing point.
|
731
714
|
*/
|
732
715
|
static VALUE
|
733
|
-
|
716
|
+
rxml_reader_column_number(VALUE self)
|
734
717
|
{
|
735
|
-
return INT2NUM(xmlTextReaderGetParserColumnNumber(
|
718
|
+
return INT2NUM(xmlTextReaderGetParserColumnNumber(rxml_text_reader_get(self)));
|
736
719
|
}
|
737
720
|
|
738
721
|
/*
|
@@ -742,9 +725,9 @@ ruby_xml_reader_column_number(VALUE self)
|
|
742
725
|
* Provide the line number of the current parsing point.
|
743
726
|
*/
|
744
727
|
static VALUE
|
745
|
-
|
728
|
+
rxml_reader_line_number(VALUE self)
|
746
729
|
{
|
747
|
-
return INT2NUM(xmlTextReaderGetParserLineNumber(
|
730
|
+
return INT2NUM(xmlTextReaderGetParserLineNumber(rxml_text_reader_get(self)));
|
748
731
|
}
|
749
732
|
#endif
|
750
733
|
|
@@ -756,9 +739,9 @@ ruby_xml_reader_line_number(VALUE self)
|
|
756
739
|
* defined in the DTD or schema.
|
757
740
|
*/
|
758
741
|
static VALUE
|
759
|
-
|
742
|
+
rxml_reader_default(VALUE self)
|
760
743
|
{
|
761
|
-
return xmlTextReaderIsDefault(
|
744
|
+
return xmlTextReaderIsDefault(rxml_text_reader_get(self)) ? Qtrue : Qfalse;
|
762
745
|
}
|
763
746
|
|
764
747
|
/*
|
@@ -769,9 +752,9 @@ ruby_xml_reader_default(VALUE self)
|
|
769
752
|
* regular attribute.
|
770
753
|
*/
|
771
754
|
static VALUE
|
772
|
-
|
755
|
+
rxml_reader_namespace_declaration(VALUE self)
|
773
756
|
{
|
774
|
-
return xmlTextReaderIsNamespaceDecl(
|
757
|
+
return xmlTextReaderIsNamespaceDecl(rxml_text_reader_get(self)) ? Qtrue : Qfalse;
|
775
758
|
}
|
776
759
|
|
777
760
|
/*
|
@@ -781,9 +764,9 @@ ruby_xml_reader_namespace_declaration(VALUE self)
|
|
781
764
|
* Check if the current node is empty.
|
782
765
|
*/
|
783
766
|
static VALUE
|
784
|
-
|
767
|
+
rxml_reader_empty_element(VALUE self)
|
785
768
|
{
|
786
|
-
return xmlTextReaderIsEmptyElement(
|
769
|
+
return xmlTextReaderIsEmptyElement(rxml_text_reader_get(self)) ? Qtrue : Qfalse;
|
787
770
|
}
|
788
771
|
|
789
772
|
/*
|
@@ -793,9 +776,9 @@ ruby_xml_reader_empty_element(VALUE self)
|
|
793
776
|
* Retrieve the validity status from the parser context.
|
794
777
|
*/
|
795
778
|
static VALUE
|
796
|
-
|
779
|
+
rxml_reader_valid(VALUE self)
|
797
780
|
{
|
798
|
-
return xmlTextReaderIsValid(
|
781
|
+
return xmlTextReaderIsValid(rxml_text_reader_get(self)) ? Qtrue : Qfalse;
|
799
782
|
}
|
800
783
|
|
801
784
|
/* Rdoc needs to know. */
|
@@ -809,67 +792,67 @@ ruby_init_xml_reader(void)
|
|
809
792
|
{
|
810
793
|
cXMLReader = rb_define_class_under(mXML, "Reader", rb_cObject);
|
811
794
|
|
812
|
-
rb_define_singleton_method(cXMLReader, "file",
|
813
|
-
rb_define_singleton_method(cXMLReader, "io",
|
814
|
-
rb_define_singleton_method(cXMLReader, "walker",
|
795
|
+
rb_define_singleton_method(cXMLReader, "file", rxml_reader_new_file, -1);
|
796
|
+
rb_define_singleton_method(cXMLReader, "io", rxml_reader_new_io, -1);
|
797
|
+
rb_define_singleton_method(cXMLReader, "walker", rxml_reader_new_walker, 1);
|
815
798
|
rb_define_alias(CLASS_OF(cXMLReader), "document", "walker");
|
816
|
-
rb_define_singleton_method(cXMLReader, "new",
|
799
|
+
rb_define_singleton_method(cXMLReader, "new", rxml_reader_new_data, -1);
|
817
800
|
rb_define_alias(CLASS_OF(cXMLReader), "string", "new");
|
818
801
|
|
819
|
-
rb_define_method(cXMLReader, "close",
|
820
|
-
|
821
|
-
rb_define_method(cXMLReader, "move_to_attribute",
|
822
|
-
rb_define_method(cXMLReader, "move_to_first_attribute",
|
823
|
-
rb_define_method(cXMLReader, "move_to_next_attribute",
|
824
|
-
rb_define_method(cXMLReader, "move_to_element",
|
825
|
-
rb_define_method(cXMLReader, "next",
|
826
|
-
rb_define_method(cXMLReader, "next_sibling",
|
827
|
-
rb_define_method(cXMLReader, "read",
|
828
|
-
rb_define_method(cXMLReader, "read_attribute_value",
|
829
|
-
rb_define_method(cXMLReader, "read_inner_xml",
|
830
|
-
rb_define_method(cXMLReader, "read_outer_xml",
|
831
|
-
rb_define_method(cXMLReader, "read_state",
|
832
|
-
rb_define_method(cXMLReader, "read_string",
|
833
|
-
|
834
|
-
rb_define_method(cXMLReader, "relax_ng_validate",
|
802
|
+
rb_define_method(cXMLReader, "close", rxml_reader_close, 0);
|
803
|
+
|
804
|
+
rb_define_method(cXMLReader, "move_to_attribute", rxml_reader_move_to_attr, 1);
|
805
|
+
rb_define_method(cXMLReader, "move_to_first_attribute", rxml_reader_move_to_first_attr, 0);
|
806
|
+
rb_define_method(cXMLReader, "move_to_next_attribute", rxml_reader_move_to_next_attr, 0);
|
807
|
+
rb_define_method(cXMLReader, "move_to_element", rxml_reader_move_to_element, 0);
|
808
|
+
rb_define_method(cXMLReader, "next", rxml_reader_next, 0);
|
809
|
+
rb_define_method(cXMLReader, "next_sibling", rxml_reader_next_sibling, 0);
|
810
|
+
rb_define_method(cXMLReader, "read", rxml_reader_read, 0);
|
811
|
+
rb_define_method(cXMLReader, "read_attribute_value", rxml_reader_read_attr_value, 0);
|
812
|
+
rb_define_method(cXMLReader, "read_inner_xml", rxml_reader_read_inner_xml, 0);
|
813
|
+
rb_define_method(cXMLReader, "read_outer_xml", rxml_reader_read_outer_xml, 0);
|
814
|
+
rb_define_method(cXMLReader, "read_state", rxml_reader_read_state, 0);
|
815
|
+
rb_define_method(cXMLReader, "read_string", rxml_reader_read_string, 0);
|
816
|
+
|
817
|
+
rb_define_method(cXMLReader, "relax_ng_validate", rxml_reader_relax_ng_validate, 1);
|
835
818
|
#if LIBXML_VERSION >= 20620
|
836
|
-
rb_define_method(cXMLReader, "schema_validate",
|
819
|
+
rb_define_method(cXMLReader, "schema_validate", rxml_reader_schema_validate, 1);
|
837
820
|
#endif
|
838
821
|
|
839
|
-
rb_define_method(cXMLReader, "node_type",
|
840
|
-
rb_define_method(cXMLReader, "normalization",
|
841
|
-
rb_define_method(cXMLReader, "attribute_count",
|
842
|
-
rb_define_method(cXMLReader, "name",
|
843
|
-
rb_define_method(cXMLReader, "local_name",
|
844
|
-
rb_define_method(cXMLReader, "encoding",
|
845
|
-
rb_define_method(cXMLReader, "base_uri",
|
846
|
-
rb_define_method(cXMLReader, "namespace_uri",
|
847
|
-
rb_define_method(cXMLReader, "xml_lang",
|
848
|
-
rb_define_method(cXMLReader, "xml_version",
|
849
|
-
rb_define_method(cXMLReader, "prefix",
|
850
|
-
rb_define_method(cXMLReader, "depth",
|
851
|
-
rb_define_method(cXMLReader, "quote_char",
|
852
|
-
rb_define_method(cXMLReader, "standalone",
|
822
|
+
rb_define_method(cXMLReader, "node_type", rxml_reader_node_type, 0);
|
823
|
+
rb_define_method(cXMLReader, "normalization", rxml_reader_normalization, 0);
|
824
|
+
rb_define_method(cXMLReader, "attribute_count", rxml_reader_attr_count, 0);
|
825
|
+
rb_define_method(cXMLReader, "name", rxml_reader_name, 0);
|
826
|
+
rb_define_method(cXMLReader, "local_name", rxml_reader_local_name, 0);
|
827
|
+
rb_define_method(cXMLReader, "encoding", rxml_reader_encoding, 0);
|
828
|
+
rb_define_method(cXMLReader, "base_uri", rxml_reader_base_uri, 0);
|
829
|
+
rb_define_method(cXMLReader, "namespace_uri", rxml_reader_namespace_uri, 0);
|
830
|
+
rb_define_method(cXMLReader, "xml_lang", rxml_reader_xml_lang, 0);
|
831
|
+
rb_define_method(cXMLReader, "xml_version", rxml_reader_xml_version, 0);
|
832
|
+
rb_define_method(cXMLReader, "prefix", rxml_reader_prefix, 0);
|
833
|
+
rb_define_method(cXMLReader, "depth", rxml_reader_depth, 0);
|
834
|
+
rb_define_method(cXMLReader, "quote_char", rxml_reader_quote_char, 0);
|
835
|
+
rb_define_method(cXMLReader, "standalone", rxml_reader_standalone, 0);
|
853
836
|
|
854
|
-
rb_define_method(cXMLReader, "has_attributes?",
|
855
|
-
rb_define_method(cXMLReader, "[]",
|
856
|
-
rb_define_method(cXMLReader, "has_value?",
|
857
|
-
rb_define_method(cXMLReader, "value",
|
837
|
+
rb_define_method(cXMLReader, "has_attributes?", rxml_reader_has_attributes, 0);
|
838
|
+
rb_define_method(cXMLReader, "[]", rxml_reader_attribute, 1);
|
839
|
+
rb_define_method(cXMLReader, "has_value?", rxml_reader_has_value, 0);
|
840
|
+
rb_define_method(cXMLReader, "value", rxml_reader_value, 0);
|
858
841
|
|
859
|
-
rb_define_method(cXMLReader, "lookup_namespace",
|
860
|
-
rb_define_method(cXMLReader, "expand",
|
842
|
+
rb_define_method(cXMLReader, "lookup_namespace", rxml_reader_lookup_namespace, 1);
|
843
|
+
rb_define_method(cXMLReader, "expand", rxml_reader_expand, 0);
|
861
844
|
|
862
845
|
#if LIBXML_VERSION >= 20618
|
863
|
-
rb_define_method(cXMLReader, "byte_consumed",
|
846
|
+
rb_define_method(cXMLReader, "byte_consumed", rxml_reader_byte_consumed, 0);
|
864
847
|
#endif
|
865
848
|
#if LIBXML_VERSION >= 20617
|
866
|
-
rb_define_method(cXMLReader, "column_number",
|
867
|
-
rb_define_method(cXMLReader, "line_number",
|
849
|
+
rb_define_method(cXMLReader, "column_number", rxml_reader_column_number, 0);
|
850
|
+
rb_define_method(cXMLReader, "line_number", rxml_reader_line_number, 0);
|
868
851
|
#endif
|
869
|
-
rb_define_method(cXMLReader, "default?",
|
870
|
-
rb_define_method(cXMLReader, "empty_element?",
|
871
|
-
rb_define_method(cXMLReader, "namespace_declaration?",
|
872
|
-
rb_define_method(cXMLReader, "valid?",
|
852
|
+
rb_define_method(cXMLReader, "default?", rxml_reader_default, 0);
|
853
|
+
rb_define_method(cXMLReader, "empty_element?", rxml_reader_empty_element, 0);
|
854
|
+
rb_define_method(cXMLReader, "namespace_declaration?", rxml_reader_namespace_declaration, 0);
|
855
|
+
rb_define_method(cXMLReader, "valid?", rxml_reader_valid, 0);
|
873
856
|
|
874
857
|
rb_define_const(cXMLReader, "LOADDTD", INT2FIX(XML_PARSER_LOADDTD));
|
875
858
|
rb_define_const(cXMLReader, "DEFAULTATTRS", INT2FIX(XML_PARSER_DEFAULTATTRS));
|