libxml-ruby 0.9.2 → 0.9.3
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/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
data/ext/libxml/ruby_libxml.h
CHANGED
@@ -1,72 +1,70 @@
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
-
|
3
|
-
#ifndef __RUBY_LIBXML_H__
|
4
|
-
#define __RUBY_LIBXML_H__
|
5
|
-
|
6
|
-
#include "version.h"
|
7
|
-
|
8
|
-
#include <ruby.h>
|
9
|
-
#include <rubyio.h>
|
10
|
-
#include <util.h>
|
11
|
-
#include <libxml/parser.h>
|
12
|
-
#include <libxml/parserInternals.h>
|
13
|
-
#include <libxml/debugXML.h>
|
14
|
-
#include <libxml/xmlversion.h>
|
15
|
-
#include <libxml/xmlmemory.h>
|
16
|
-
#include <libxml/xpath.h>
|
17
|
-
#include <libxml/valid.h>
|
18
|
-
#include <libxml/catalog.h>
|
19
|
-
#include <libxml/HTMLparser.h>
|
20
|
-
#include <libxml/xmlreader.h>
|
21
|
-
|
22
|
-
// Maybe not yet defined in ruby
|
23
|
-
#ifndef RSTRING_LEN
|
24
|
-
#define RSTRING_LEN(x) RSTRING(x)->len
|
25
|
-
#endif
|
26
|
-
|
27
|
-
// not in Ruby 1.9
|
28
|
-
#ifndef GetWriteFile
|
29
|
-
#define GetWriteFile(fp) rb_io_stdio_file(fp)
|
30
|
-
#define OpenFile rb_io_t
|
31
|
-
#endif
|
32
|
-
|
33
|
-
#ifdef LIBXML_DEBUG_ENABLED
|
34
|
-
#include <libxml/xpathInternals.h>
|
35
|
-
#endif
|
36
|
-
#ifdef LIBXML_XINCLUDE_ENABLED
|
37
|
-
#include <libxml/xinclude.h>
|
38
|
-
#endif
|
39
|
-
#ifdef LIBXML_XPTR_ENABLED
|
40
|
-
#include <libxml/xpointer.h>
|
41
|
-
#endif
|
42
|
-
|
43
|
-
|
44
|
-
#include "
|
45
|
-
#include "
|
46
|
-
#include "
|
47
|
-
#include "
|
48
|
-
#include "
|
49
|
-
#include "
|
50
|
-
#include "
|
51
|
-
#include "
|
52
|
-
#include "
|
53
|
-
#include "
|
54
|
-
#include "
|
55
|
-
#include "
|
56
|
-
#include "
|
57
|
-
#include "
|
58
|
-
#include "
|
59
|
-
#include "
|
60
|
-
#include "
|
61
|
-
#include "
|
62
|
-
#include "
|
63
|
-
#include "
|
64
|
-
#include "
|
65
|
-
#include "
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
#endif
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
+
|
3
|
+
#ifndef __RUBY_LIBXML_H__
|
4
|
+
#define __RUBY_LIBXML_H__
|
5
|
+
|
6
|
+
#include "version.h"
|
7
|
+
|
8
|
+
#include <ruby.h>
|
9
|
+
#include <rubyio.h>
|
10
|
+
#include <util.h>
|
11
|
+
#include <libxml/parser.h>
|
12
|
+
#include <libxml/parserInternals.h>
|
13
|
+
#include <libxml/debugXML.h>
|
14
|
+
#include <libxml/xmlversion.h>
|
15
|
+
#include <libxml/xmlmemory.h>
|
16
|
+
#include <libxml/xpath.h>
|
17
|
+
#include <libxml/valid.h>
|
18
|
+
#include <libxml/catalog.h>
|
19
|
+
#include <libxml/HTMLparser.h>
|
20
|
+
#include <libxml/xmlreader.h>
|
21
|
+
|
22
|
+
// Maybe not yet defined in ruby
|
23
|
+
#ifndef RSTRING_LEN
|
24
|
+
#define RSTRING_LEN(x) RSTRING(x)->len
|
25
|
+
#endif
|
26
|
+
|
27
|
+
// not in Ruby 1.9
|
28
|
+
#ifndef GetWriteFile
|
29
|
+
#define GetWriteFile(fp) rb_io_stdio_file(fp)
|
30
|
+
#define OpenFile rb_io_t
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#ifdef LIBXML_DEBUG_ENABLED
|
34
|
+
#include <libxml/xpathInternals.h>
|
35
|
+
#endif
|
36
|
+
#ifdef LIBXML_XINCLUDE_ENABLED
|
37
|
+
#include <libxml/xinclude.h>
|
38
|
+
#endif
|
39
|
+
#ifdef LIBXML_XPTR_ENABLED
|
40
|
+
#include <libxml/xpointer.h>
|
41
|
+
#endif
|
42
|
+
|
43
|
+
#include "ruby_xml_error.h"
|
44
|
+
#include "ruby_xml_input.h"
|
45
|
+
#include "ruby_xml_state.h"
|
46
|
+
#include "ruby_xml_attributes.h"
|
47
|
+
#include "ruby_xml_attr.h"
|
48
|
+
#include "ruby_xml_document.h"
|
49
|
+
#include "ruby_xml_node.h"
|
50
|
+
#include "ruby_xml_ns.h"
|
51
|
+
#include "ruby_xml_parser.h"
|
52
|
+
#include "ruby_xml_parser_context.h"
|
53
|
+
#include "ruby_xml_sax_parser.h"
|
54
|
+
#include "ruby_xml_xinclude.h"
|
55
|
+
#include "ruby_xml_xpath.h"
|
56
|
+
#include "ruby_xml_xpath_expression.h"
|
57
|
+
#include "ruby_xml_xpath_context.h"
|
58
|
+
#include "ruby_xml_xpath_object.h"
|
59
|
+
#include "ruby_xml_xpointer.h"
|
60
|
+
#include "ruby_xml_input_cbg.h"
|
61
|
+
#include "ruby_xml_dtd.h"
|
62
|
+
#include "ruby_xml_schema.h"
|
63
|
+
#include "ruby_xml_relaxng.h"
|
64
|
+
#include "ruby_xml_html_parser.h"
|
65
|
+
#include "ruby_xml_reader.h"
|
66
|
+
|
67
|
+
extern VALUE mLibXML;
|
68
|
+
extern VALUE mXML;
|
69
|
+
|
70
|
+
#endif
|
data/ext/libxml/ruby_xml_attr.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: ruby_xml_attr.c
|
1
|
+
/* $Id: ruby_xml_attr.c 612 2008-11-21 08:01:29Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
@@ -23,7 +23,7 @@
|
|
23
23
|
|
24
24
|
VALUE cXMLAttr;
|
25
25
|
|
26
|
-
void
|
26
|
+
void rxml_attr_free(xmlAttrPtr xattr) {
|
27
27
|
if (!xattr) return;
|
28
28
|
|
29
29
|
if (xattr != NULL ) {
|
@@ -40,7 +40,7 @@ void ruby_xml_attr_free(xmlAttrPtr xattr) {
|
|
40
40
|
}
|
41
41
|
|
42
42
|
void
|
43
|
-
|
43
|
+
rxml_attr_mark(xmlAttrPtr xattr) {
|
44
44
|
if (xattr == NULL) return;
|
45
45
|
|
46
46
|
if (xattr->_private == NULL ) {
|
@@ -49,11 +49,11 @@ ruby_xml_attr_mark(xmlAttrPtr xattr) {
|
|
49
49
|
return;
|
50
50
|
}
|
51
51
|
|
52
|
-
|
52
|
+
rxml_node_mark_common((xmlNodePtr)xattr);
|
53
53
|
}
|
54
54
|
|
55
55
|
VALUE
|
56
|
-
|
56
|
+
rxml_attr_wrap(xmlAttrPtr xattr)
|
57
57
|
{
|
58
58
|
VALUE result;
|
59
59
|
// This node is already wrapped
|
@@ -61,7 +61,7 @@ ruby_xml_attr_wrap(xmlAttrPtr xattr)
|
|
61
61
|
return (VALUE)xattr->_private;
|
62
62
|
|
63
63
|
result = Data_Wrap_Struct(cXMLAttr,
|
64
|
-
|
64
|
+
rxml_attr_mark, rxml_attr_free,
|
65
65
|
xattr);
|
66
66
|
|
67
67
|
xattr->_private=(void*)result;
|
@@ -72,11 +72,11 @@ ruby_xml_attr_wrap(xmlAttrPtr xattr)
|
|
72
72
|
}
|
73
73
|
|
74
74
|
|
75
|
-
VALUE
|
76
|
-
|
75
|
+
static VALUE
|
76
|
+
rxml_attr_alloc(VALUE klass)
|
77
77
|
{
|
78
78
|
return Data_Wrap_Struct(cXMLAttr,
|
79
|
-
|
79
|
+
rxml_attr_mark, rxml_attr_free,
|
80
80
|
NULL);
|
81
81
|
}
|
82
82
|
|
@@ -92,8 +92,8 @@ ruby_xml_attr_alloc(VALUE klass)
|
|
92
92
|
*
|
93
93
|
* attr = XML::Attr.new(doc.root, 'name', 'libxml')
|
94
94
|
*/
|
95
|
-
VALUE
|
96
|
-
|
95
|
+
static VALUE
|
96
|
+
rxml_attr_initialize(int argc, VALUE *argv, VALUE self) {
|
97
97
|
VALUE node = argv[0];
|
98
98
|
VALUE name = argv[1];
|
99
99
|
VALUE value = argv[2];
|
@@ -138,14 +138,14 @@ ruby_xml_attr_initialize(int argc, VALUE *argv, VALUE self) {
|
|
138
138
|
*
|
139
139
|
* Obtain this attribute's child attribute(s).
|
140
140
|
*/
|
141
|
-
VALUE
|
142
|
-
|
141
|
+
static VALUE
|
142
|
+
rxml_attr_child_get(VALUE self) {
|
143
143
|
xmlAttrPtr xattr;
|
144
144
|
Data_Get_Struct(self, xmlAttr, xattr);
|
145
145
|
if (xattr->children == NULL)
|
146
146
|
return(Qnil);
|
147
147
|
else
|
148
|
-
return(
|
148
|
+
return(rxml_node2_wrap(cXMLNode, (xmlNodePtr)xattr->children));
|
149
149
|
}
|
150
150
|
|
151
151
|
|
@@ -155,8 +155,8 @@ ruby_xml_attr_child_get(VALUE self) {
|
|
155
155
|
*
|
156
156
|
* Returns whether this attribute has child attributes.
|
157
157
|
*/
|
158
|
-
VALUE
|
159
|
-
|
158
|
+
static VALUE
|
159
|
+
rxml_attr_child_q(VALUE self) {
|
160
160
|
xmlAttrPtr xattr;
|
161
161
|
Data_Get_Struct(self, xmlAttr, xattr);
|
162
162
|
if (xattr->children == NULL)
|
@@ -174,14 +174,14 @@ ruby_xml_attr_child_q(VALUE self) {
|
|
174
174
|
*
|
175
175
|
* doc.root.attributes.get_attribute('name').doc == doc
|
176
176
|
*/
|
177
|
-
VALUE
|
178
|
-
|
177
|
+
static VALUE
|
178
|
+
rxml_attr_doc_get(VALUE self) {
|
179
179
|
xmlAttrPtr xattr;
|
180
180
|
Data_Get_Struct(self, xmlAttr, xattr);
|
181
181
|
if (xattr->doc == NULL)
|
182
182
|
return(Qnil);
|
183
183
|
else
|
184
|
-
return(
|
184
|
+
return(rxml_document_wrap(xattr->doc));
|
185
185
|
}
|
186
186
|
|
187
187
|
/*
|
@@ -191,8 +191,8 @@ ruby_xml_attr_doc_get(VALUE self) {
|
|
191
191
|
* Determine whether this attribute is associated with an
|
192
192
|
* XML::Document.
|
193
193
|
*/
|
194
|
-
VALUE
|
195
|
-
|
194
|
+
static VALUE
|
195
|
+
rxml_attr_doc_q(VALUE self) {
|
196
196
|
xmlAttrPtr xattr;
|
197
197
|
Data_Get_Struct(self, xmlAttr, xattr);
|
198
198
|
if (xattr->doc == NULL)
|
@@ -208,14 +208,14 @@ ruby_xml_attr_doc_q(VALUE self) {
|
|
208
208
|
*
|
209
209
|
* Obtain the last attribute.
|
210
210
|
*/
|
211
|
-
VALUE
|
212
|
-
|
211
|
+
static VALUE
|
212
|
+
rxml_attr_last_get(VALUE self) {
|
213
213
|
xmlAttrPtr xattr;
|
214
214
|
Data_Get_Struct(self, xmlAttr, xattr);
|
215
215
|
if (xattr->last == NULL)
|
216
216
|
return(Qnil);
|
217
217
|
else
|
218
|
-
return(
|
218
|
+
return(rxml_node2_wrap(cXMLNode, xattr->last));
|
219
219
|
}
|
220
220
|
|
221
221
|
|
@@ -225,8 +225,8 @@ ruby_xml_attr_last_get(VALUE self) {
|
|
225
225
|
*
|
226
226
|
* Determine whether this is the last attribute.
|
227
227
|
*/
|
228
|
-
VALUE
|
229
|
-
|
228
|
+
static VALUE
|
229
|
+
rxml_attr_last_q(VALUE self) {
|
230
230
|
xmlAttrPtr xattr;
|
231
231
|
Data_Get_Struct(self, xmlAttr, xattr);
|
232
232
|
if (xattr->last == NULL)
|
@@ -241,8 +241,8 @@ ruby_xml_attr_last_q(VALUE self) {
|
|
241
241
|
*
|
242
242
|
* Obtain this attribute's name.
|
243
243
|
*/
|
244
|
-
VALUE
|
245
|
-
|
244
|
+
static VALUE
|
245
|
+
rxml_attr_name_get(VALUE self) {
|
246
246
|
xmlAttrPtr xattr;
|
247
247
|
Data_Get_Struct(self, xmlAttr, xattr);
|
248
248
|
|
@@ -258,14 +258,14 @@ ruby_xml_attr_name_get(VALUE self) {
|
|
258
258
|
*
|
259
259
|
* Obtain the next attribute.
|
260
260
|
*/
|
261
|
-
VALUE
|
262
|
-
|
261
|
+
static VALUE
|
262
|
+
rxml_attr_next_get(VALUE self) {
|
263
263
|
xmlAttrPtr xattr;
|
264
264
|
Data_Get_Struct(self, xmlAttr, xattr);
|
265
265
|
if (xattr->next == NULL)
|
266
266
|
return(Qnil);
|
267
267
|
else
|
268
|
-
return(
|
268
|
+
return(rxml_attr_wrap(xattr->next));
|
269
269
|
}
|
270
270
|
|
271
271
|
|
@@ -275,8 +275,8 @@ ruby_xml_attr_next_get(VALUE self) {
|
|
275
275
|
*
|
276
276
|
* Determine whether there is a next attribute.
|
277
277
|
*/
|
278
|
-
VALUE
|
279
|
-
|
278
|
+
static VALUE
|
279
|
+
rxml_attr_next_q(VALUE self) {
|
280
280
|
xmlAttrPtr xattr;
|
281
281
|
Data_Get_Struct(self, xmlAttr, xattr);
|
282
282
|
if (xattr->next == NULL)
|
@@ -292,8 +292,8 @@ ruby_xml_attr_next_q(VALUE self) {
|
|
292
292
|
*
|
293
293
|
* Obtain this attribute node's type name.
|
294
294
|
*/
|
295
|
-
VALUE
|
296
|
-
|
295
|
+
static VALUE
|
296
|
+
rxml_attr_node_type_name(VALUE self) {
|
297
297
|
return(rb_str_new2("attribute"));
|
298
298
|
}
|
299
299
|
|
@@ -304,14 +304,14 @@ ruby_xml_attr_node_type_name(VALUE self) {
|
|
304
304
|
*
|
305
305
|
* Obtain this attribute's associated XML::NS, if any.
|
306
306
|
*/
|
307
|
-
VALUE
|
308
|
-
|
307
|
+
static VALUE
|
308
|
+
rxml_attr_ns_get(VALUE self) {
|
309
309
|
xmlAttrPtr xattr;
|
310
310
|
Data_Get_Struct(self, xmlAttr, xattr);
|
311
311
|
if (xattr->ns == NULL)
|
312
312
|
return(Qnil);
|
313
313
|
else
|
314
|
-
return(
|
314
|
+
return(rxml_ns_wrap(xattr->ns));
|
315
315
|
}
|
316
316
|
|
317
317
|
|
@@ -322,8 +322,8 @@ ruby_xml_attr_ns_get(VALUE self) {
|
|
322
322
|
* Determine whether this attribute has an associated
|
323
323
|
* namespace.
|
324
324
|
*/
|
325
|
-
VALUE
|
326
|
-
|
325
|
+
static VALUE
|
326
|
+
rxml_attr_ns_q(VALUE self) {
|
327
327
|
xmlAttrPtr xattr;
|
328
328
|
Data_Get_Struct(self, xmlAttr, xattr);
|
329
329
|
if (xattr->ns == NULL)
|
@@ -339,14 +339,14 @@ ruby_xml_attr_ns_q(VALUE self) {
|
|
339
339
|
*
|
340
340
|
* Obtain this attribute node's parent.
|
341
341
|
*/
|
342
|
-
VALUE
|
343
|
-
|
342
|
+
static VALUE
|
343
|
+
rxml_attr_parent_get(VALUE self) {
|
344
344
|
xmlAttrPtr xattr;
|
345
345
|
Data_Get_Struct(self, xmlAttr, xattr);
|
346
346
|
if (xattr->parent == NULL)
|
347
347
|
return(Qnil);
|
348
348
|
else
|
349
|
-
return(
|
349
|
+
return(rxml_node2_wrap(cXMLNode, xattr->parent));
|
350
350
|
}
|
351
351
|
|
352
352
|
|
@@ -356,8 +356,8 @@ ruby_xml_attr_parent_get(VALUE self) {
|
|
356
356
|
*
|
357
357
|
* Determine whether this attribute has a parent.
|
358
358
|
*/
|
359
|
-
VALUE
|
360
|
-
|
359
|
+
static VALUE
|
360
|
+
rxml_attr_parent_q(VALUE self) {
|
361
361
|
xmlAttrPtr xattr;
|
362
362
|
Data_Get_Struct(self, xmlAttr, xattr);
|
363
363
|
if (xattr->parent == NULL)
|
@@ -373,14 +373,14 @@ ruby_xml_attr_parent_q(VALUE self) {
|
|
373
373
|
*
|
374
374
|
* Obtain the previous attribute.
|
375
375
|
*/
|
376
|
-
VALUE
|
377
|
-
|
376
|
+
static VALUE
|
377
|
+
rxml_attr_prev_get(VALUE self) {
|
378
378
|
xmlAttrPtr xattr;
|
379
379
|
Data_Get_Struct(self, xmlAttr, xattr);
|
380
380
|
if (xattr->prev == NULL)
|
381
381
|
return(Qnil);
|
382
382
|
else
|
383
|
-
return(
|
383
|
+
return(rxml_attr_wrap(xattr->prev));
|
384
384
|
}
|
385
385
|
|
386
386
|
|
@@ -390,8 +390,8 @@ ruby_xml_attr_prev_get(VALUE self) {
|
|
390
390
|
*
|
391
391
|
* Determine whether there is a previous attribute.
|
392
392
|
*/
|
393
|
-
VALUE
|
394
|
-
|
393
|
+
static VALUE
|
394
|
+
rxml_attr_prev_q(VALUE self) {
|
395
395
|
xmlAttrPtr xattr;
|
396
396
|
Data_Get_Struct(self, xmlAttr, xattr);
|
397
397
|
if (xattr->prev == NULL)
|
@@ -407,8 +407,8 @@ ruby_xml_attr_prev_q(VALUE self) {
|
|
407
407
|
*
|
408
408
|
* Removes this attribute from it's parent.
|
409
409
|
*/
|
410
|
-
VALUE
|
411
|
-
|
410
|
+
static VALUE
|
411
|
+
rxml_attr_remove_ex(VALUE self) {
|
412
412
|
xmlAttrPtr xattr;
|
413
413
|
Data_Get_Struct(self, xmlAttr, xattr);
|
414
414
|
|
@@ -427,13 +427,13 @@ ruby_xml_attr_remove_ex(VALUE self) {
|
|
427
427
|
* Obtain the value of this attribute.
|
428
428
|
*/
|
429
429
|
VALUE
|
430
|
-
|
430
|
+
rxml_attr_value_get(VALUE self) {
|
431
431
|
xmlAttrPtr xattr;
|
432
432
|
xmlChar *value;
|
433
433
|
VALUE result = Qnil;
|
434
434
|
|
435
435
|
Data_Get_Struct(self, xmlAttr, xattr);
|
436
|
-
if (
|
436
|
+
if (rxml_attr_parent_q(self) == Qtrue) {
|
437
437
|
value = xmlGetProp(xattr->parent, xattr->name);
|
438
438
|
if (value != NULL)
|
439
439
|
{
|
@@ -452,7 +452,7 @@ ruby_xml_attr_value_get(VALUE self) {
|
|
452
452
|
* Sets the value of this attribute.
|
453
453
|
*/
|
454
454
|
VALUE
|
455
|
-
|
455
|
+
rxml_attr_value_set(VALUE self, VALUE val) {
|
456
456
|
xmlAttrPtr xattr;
|
457
457
|
|
458
458
|
Check_Type(val, T_STRING);
|
@@ -476,25 +476,25 @@ ruby_xml_attr_value_set(VALUE self, VALUE val) {
|
|
476
476
|
void
|
477
477
|
ruby_init_xml_attr(void) {
|
478
478
|
cXMLAttr = rb_define_class_under(mXML, "Attr", rb_cObject);
|
479
|
-
rb_define_alloc_func(cXMLAttr,
|
480
|
-
rb_define_method(cXMLAttr, "initialize",
|
481
|
-
rb_define_method(cXMLAttr, "child",
|
482
|
-
rb_define_method(cXMLAttr, "child?",
|
483
|
-
rb_define_method(cXMLAttr, "doc",
|
484
|
-
rb_define_method(cXMLAttr, "doc?",
|
485
|
-
rb_define_method(cXMLAttr, "last",
|
486
|
-
rb_define_method(cXMLAttr, "last?",
|
487
|
-
rb_define_method(cXMLAttr, "name",
|
488
|
-
rb_define_method(cXMLAttr, "next",
|
489
|
-
rb_define_method(cXMLAttr, "next?",
|
490
|
-
rb_define_method(cXMLAttr, "node_type_name",
|
491
|
-
rb_define_method(cXMLAttr, "ns",
|
492
|
-
rb_define_method(cXMLAttr, "ns?",
|
493
|
-
rb_define_method(cXMLAttr, "parent",
|
494
|
-
rb_define_method(cXMLAttr, "parent?",
|
495
|
-
rb_define_method(cXMLAttr, "prev",
|
496
|
-
rb_define_method(cXMLAttr, "prev?",
|
497
|
-
rb_define_method(cXMLAttr, "remove!",
|
498
|
-
rb_define_method(cXMLAttr, "value",
|
499
|
-
rb_define_method(cXMLAttr, "value=",
|
479
|
+
rb_define_alloc_func(cXMLAttr, rxml_attr_alloc);
|
480
|
+
rb_define_method(cXMLAttr, "initialize", rxml_attr_initialize, -1);
|
481
|
+
rb_define_method(cXMLAttr, "child", rxml_attr_child_get, 0);
|
482
|
+
rb_define_method(cXMLAttr, "child?", rxml_attr_child_q, 0);
|
483
|
+
rb_define_method(cXMLAttr, "doc", rxml_attr_doc_get, 0);
|
484
|
+
rb_define_method(cXMLAttr, "doc?", rxml_attr_doc_q, 0);
|
485
|
+
rb_define_method(cXMLAttr, "last", rxml_attr_last_get, 0);
|
486
|
+
rb_define_method(cXMLAttr, "last?", rxml_attr_last_q, 0);
|
487
|
+
rb_define_method(cXMLAttr, "name", rxml_attr_name_get, 0);
|
488
|
+
rb_define_method(cXMLAttr, "next", rxml_attr_next_get, 0);
|
489
|
+
rb_define_method(cXMLAttr, "next?", rxml_attr_next_q, 0);
|
490
|
+
rb_define_method(cXMLAttr, "node_type_name", rxml_attr_node_type_name, 0);
|
491
|
+
rb_define_method(cXMLAttr, "ns", rxml_attr_ns_get, 0);
|
492
|
+
rb_define_method(cXMLAttr, "ns?", rxml_attr_ns_q, 0);
|
493
|
+
rb_define_method(cXMLAttr, "parent", rxml_attr_parent_get, 0);
|
494
|
+
rb_define_method(cXMLAttr, "parent?", rxml_attr_parent_q, 0);
|
495
|
+
rb_define_method(cXMLAttr, "prev", rxml_attr_prev_get, 0);
|
496
|
+
rb_define_method(cXMLAttr, "prev?", rxml_attr_prev_q, 0);
|
497
|
+
rb_define_method(cXMLAttr, "remove!", rxml_attr_remove_ex, 0);
|
498
|
+
rb_define_method(cXMLAttr, "value", rxml_attr_value_get, 0);
|
499
|
+
rb_define_method(cXMLAttr, "value=", rxml_attr_value_set, 1);
|
500
500
|
}
|