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,15 +1,11 @@
|
|
1
|
-
/* $Id: ruby_xml_xpath_context.h
|
1
|
+
/* $Id: ruby_xml_xpath_context.h 614 2008-11-22 08:04:39Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
5
|
-
#ifndef
|
6
|
-
#define
|
5
|
+
#ifndef __rxml_XPATH_CONTEXT__
|
6
|
+
#define __rxml_XPATH_CONTEXT__
|
7
7
|
|
8
8
|
extern VALUE cXMLXPathContext;
|
9
9
|
void ruby_init_xml_xpath_context(void);
|
10
10
|
|
11
|
-
VALUE ruby_xml_xpath_context_register_namespaces(VALUE self, VALUE nslist);
|
12
|
-
VALUE ruby_xml_xpath_context_register_namespaces_from_node(VALUE self, VALUE node);
|
13
|
-
VALUE ruby_xml_xpath_context_find(VALUE self, VALUE xpath_expr);
|
14
|
-
|
15
11
|
#endif
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id:
|
1
|
+
/* $Id: rxml_xpath.c 461 2008-07-15 21:35:56Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
@@ -23,16 +23,16 @@
|
|
23
23
|
|
24
24
|
VALUE cXMLXPathExpression;
|
25
25
|
|
26
|
-
void
|
27
|
-
|
26
|
+
static void
|
27
|
+
rxml_xpath_expression_free(xmlXPathCompExprPtr expr) {
|
28
28
|
xmlXPathFreeCompExpr(expr);
|
29
29
|
}
|
30
30
|
|
31
|
-
VALUE
|
32
|
-
|
31
|
+
static VALUE
|
32
|
+
rxml_xpath_expression_alloc(VALUE klass) {
|
33
33
|
return Data_Wrap_Struct(cXMLXPathExpression,
|
34
34
|
NULL,
|
35
|
-
|
35
|
+
rxml_xpath_expression_free,
|
36
36
|
NULL);
|
37
37
|
}
|
38
38
|
|
@@ -46,13 +46,13 @@ ruby_xml_xpath_expression_alloc(VALUE klass) {
|
|
46
46
|
* expr = XPath::Expression.new('//first')
|
47
47
|
* nodes = doc.find(expr)
|
48
48
|
*/
|
49
|
-
VALUE
|
50
|
-
|
49
|
+
static VALUE
|
50
|
+
rxml_xpath_expression_initialize(VALUE self, VALUE expression) {
|
51
51
|
xmlXPathCompExprPtr compexpr = xmlXPathCompile(StringValueCStr(expression));
|
52
52
|
|
53
53
|
if (compexpr == NULL) {
|
54
54
|
xmlErrorPtr xerror = xmlGetLastError();
|
55
|
-
|
55
|
+
rxml_raise(xerror);
|
56
56
|
}
|
57
57
|
|
58
58
|
DATA_PTR(self) = compexpr;
|
@@ -62,8 +62,8 @@ ruby_xml_xpath_expression_initialize(VALUE self, VALUE expression) {
|
|
62
62
|
void
|
63
63
|
ruby_init_xml_xpath_expression(void) {
|
64
64
|
cXMLXPathExpression = rb_define_class_under(mXPath, "Expression", rb_cObject);
|
65
|
-
rb_define_alloc_func(cXMLXPathExpression,
|
65
|
+
rb_define_alloc_func(cXMLXPathExpression, rxml_xpath_expression_alloc);
|
66
66
|
rb_define_singleton_method(rb_cRegexp, "compile", rb_class_new_instance, 1);
|
67
67
|
|
68
|
-
rb_define_method(cXMLXPathExpression, "initialize",
|
68
|
+
rb_define_method(cXMLXPathExpression, "initialize", rxml_xpath_expression_initialize, 1);
|
69
69
|
}
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
5
|
-
#ifndef
|
6
|
-
#define
|
5
|
+
#ifndef __rxml_XPATH_EXPRESSION__
|
6
|
+
#define __rxml_XPATH_EXPRESSION__
|
7
7
|
|
8
8
|
extern VALUE cXMLXPathExpression;
|
9
9
|
|
@@ -12,8 +12,8 @@
|
|
12
12
|
VALUE cXMLXPathObject;
|
13
13
|
|
14
14
|
|
15
|
-
xmlDocPtr
|
16
|
-
|
15
|
+
static xmlDocPtr
|
16
|
+
rxml_xpath_object_doc(xmlXPathObjectPtr xpop)
|
17
17
|
{
|
18
18
|
xmlDocPtr result = NULL;
|
19
19
|
xmlNodePtr *nodes = NULL;
|
@@ -32,14 +32,14 @@ ruby_xml_xpath_object_doc(xmlXPathObjectPtr xpop)
|
|
32
32
|
return (*nodes)->doc;
|
33
33
|
}
|
34
34
|
|
35
|
-
void
|
36
|
-
|
35
|
+
static void
|
36
|
+
rxml_xpath_object_mark(xmlXPathObjectPtr xpop)
|
37
37
|
{
|
38
38
|
int i;
|
39
39
|
|
40
40
|
if ( xpop->type == XPATH_NODESET && xpop->nodesetval != NULL )
|
41
41
|
{
|
42
|
-
xmlDocPtr xdoc =
|
42
|
+
xmlDocPtr xdoc = rxml_xpath_object_doc(xpop);
|
43
43
|
if (xdoc && xdoc->_private)
|
44
44
|
rb_gc_mark((VALUE)xdoc->_private);
|
45
45
|
|
@@ -51,27 +51,17 @@ ruby_xml_xpath_object_mark(xmlXPathObjectPtr xpop)
|
|
51
51
|
}
|
52
52
|
}
|
53
53
|
|
54
|
-
void
|
55
|
-
|
54
|
+
static void
|
55
|
+
rxml_xpath_object_free(xmlXPathObjectPtr xpop)
|
56
56
|
{
|
57
|
-
/*
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
/* Now free the xpath result */
|
62
|
-
xmlXPathFreeObject(xpop);
|
63
|
-
|
64
|
-
/* Now decrement the document object if this was a
|
65
|
-
XPATH_NODESET. Note this could free the document,
|
66
|
-
which is why we do it after freeing xpop.*/
|
67
|
-
if (xdoc)
|
68
|
-
ruby_xml_document_decr(xdoc);
|
57
|
+
/* Now free the xpath result but not underlying nodes
|
58
|
+
since those belong to the document. */
|
59
|
+
xmlXPathFreeNodeSetList(xpop);
|
69
60
|
}
|
70
61
|
|
71
62
|
VALUE
|
72
|
-
|
63
|
+
rxml_xpath_object_wrap(xmlXPathObjectPtr xpop)
|
73
64
|
{
|
74
|
-
xmlDocPtr xdoc;
|
75
65
|
VALUE rval;
|
76
66
|
|
77
67
|
if ( xpop==NULL )
|
@@ -79,13 +69,9 @@ ruby_xml_xpath_object_wrap(xmlXPathObjectPtr xpop)
|
|
79
69
|
|
80
70
|
switch(xpop->type) {
|
81
71
|
case XPATH_NODESET:
|
82
|
-
xdoc = ruby_xml_xpath_object_doc(xpop);
|
83
|
-
if (xdoc)
|
84
|
-
ruby_xml_document_incr(xdoc);
|
85
|
-
|
86
72
|
rval = Data_Wrap_Struct(cXMLXPathObject,
|
87
|
-
|
88
|
-
|
73
|
+
rxml_xpath_object_mark,
|
74
|
+
rxml_xpath_object_free,
|
89
75
|
xpop);
|
90
76
|
|
91
77
|
break;
|
@@ -115,7 +101,7 @@ ruby_xml_xpath_object_wrap(xmlXPathObjectPtr xpop)
|
|
115
101
|
}
|
116
102
|
|
117
103
|
static VALUE
|
118
|
-
|
104
|
+
rxml_xpath_object_tabref(xmlXPathObjectPtr xpop, int apos) {
|
119
105
|
|
120
106
|
if (apos < 0 )
|
121
107
|
apos=xpop->nodesetval->nodeNr+apos;
|
@@ -125,10 +111,10 @@ ruby_xml_xpath_object_tabref(xmlXPathObjectPtr xpop, int apos) {
|
|
125
111
|
|
126
112
|
switch(xpop->nodesetval->nodeTab[apos]->type) {
|
127
113
|
case XML_ATTRIBUTE_NODE:
|
128
|
-
return
|
114
|
+
return rxml_attr_wrap((xmlAttrPtr)xpop->nodesetval->nodeTab[apos]);
|
129
115
|
break;
|
130
116
|
default:
|
131
|
-
return
|
117
|
+
return rxml_node2_wrap(cXMLNode,
|
132
118
|
xpop->nodesetval->nodeTab[apos]);
|
133
119
|
}
|
134
120
|
}
|
@@ -139,8 +125,8 @@ ruby_xml_xpath_object_tabref(xmlXPathObjectPtr xpop, int apos) {
|
|
139
125
|
*
|
140
126
|
* Obtain an array of the nodes in this set.
|
141
127
|
*/
|
142
|
-
VALUE
|
143
|
-
|
128
|
+
static VALUE
|
129
|
+
rxml_xpath_object_to_a(VALUE self)
|
144
130
|
{
|
145
131
|
VALUE set_ary, nodeobj;
|
146
132
|
xmlXPathObjectPtr xpop;
|
@@ -151,7 +137,7 @@ ruby_xml_xpath_object_to_a(VALUE self)
|
|
151
137
|
set_ary = rb_ary_new();
|
152
138
|
if (!((xpop->nodesetval == NULL) || (xpop->nodesetval->nodeNr == 0))) {
|
153
139
|
for (i = 0; i < xpop->nodesetval->nodeNr; i++) {
|
154
|
-
nodeobj =
|
140
|
+
nodeobj = rxml_xpath_object_tabref(xpop, i);
|
155
141
|
rb_ary_push(set_ary, nodeobj);
|
156
142
|
}
|
157
143
|
}
|
@@ -165,8 +151,8 @@ ruby_xml_xpath_object_to_a(VALUE self)
|
|
165
151
|
*
|
166
152
|
* Determine whether this nodeset is empty (contains no nodes).
|
167
153
|
*/
|
168
|
-
VALUE
|
169
|
-
|
154
|
+
static VALUE
|
155
|
+
rxml_xpath_object_empty_q(VALUE self) {
|
170
156
|
xmlXPathObjectPtr xpop;
|
171
157
|
|
172
158
|
Data_Get_Struct(self,xmlXPathObject,xpop);
|
@@ -183,19 +169,19 @@ ruby_xml_xpath_object_empty_q(VALUE self) {
|
|
183
169
|
*
|
184
170
|
* Call the supplied block for each node in this set.
|
185
171
|
*/
|
186
|
-
VALUE
|
187
|
-
|
172
|
+
static VALUE
|
173
|
+
rxml_xpath_object_each(VALUE self)
|
188
174
|
{
|
189
175
|
xmlXPathObjectPtr xpop;
|
190
176
|
int i;
|
191
177
|
|
192
|
-
if (
|
178
|
+
if ( rxml_xpath_object_empty_q(self) == Qtrue )
|
193
179
|
return Qnil;
|
194
180
|
|
195
181
|
Data_Get_Struct(self,xmlXPathObject,xpop);
|
196
182
|
|
197
183
|
for (i = 0; i < xpop->nodesetval->nodeNr; i++) {
|
198
|
-
rb_yield(
|
184
|
+
rb_yield(rxml_xpath_object_tabref(xpop,i));
|
199
185
|
}
|
200
186
|
return(self);
|
201
187
|
}
|
@@ -206,12 +192,12 @@ ruby_xml_xpath_object_each(VALUE self)
|
|
206
192
|
*
|
207
193
|
* Returns the first node in this node set, or nil if none exist.
|
208
194
|
*/
|
209
|
-
VALUE
|
210
|
-
|
211
|
-
if (
|
195
|
+
static VALUE
|
196
|
+
rxml_xpath_object_first(VALUE self) {
|
197
|
+
if ( rxml_xpath_object_empty_q(self) == Qtrue )
|
212
198
|
return Qnil;
|
213
199
|
|
214
|
-
return
|
200
|
+
return rxml_xpath_object_tabref((xmlXPathObjectPtr)DATA_PTR(self),0);
|
215
201
|
}
|
216
202
|
|
217
203
|
/*
|
@@ -220,12 +206,12 @@ ruby_xml_xpath_object_first(VALUE self) {
|
|
220
206
|
*
|
221
207
|
* array index into set of nodes
|
222
208
|
*/
|
223
|
-
VALUE
|
224
|
-
|
225
|
-
if (
|
209
|
+
static VALUE
|
210
|
+
rxml_xpath_object_aref(VALUE self, VALUE aref) {
|
211
|
+
if ( rxml_xpath_object_empty_q(self) == Qtrue )
|
226
212
|
return Qnil;
|
227
213
|
|
228
|
-
return
|
214
|
+
return rxml_xpath_object_tabref((xmlXPathObjectPtr)DATA_PTR(self),
|
229
215
|
NUM2INT(aref));
|
230
216
|
}
|
231
217
|
|
@@ -235,11 +221,11 @@ ruby_xml_xpath_object_aref(VALUE self, VALUE aref) {
|
|
235
221
|
*
|
236
222
|
* Obtain the length of the nodesetval node list.
|
237
223
|
*/
|
238
|
-
VALUE
|
239
|
-
|
224
|
+
static VALUE
|
225
|
+
rxml_xpath_object_length(VALUE self) {
|
240
226
|
xmlXPathObjectPtr xpop;
|
241
227
|
|
242
|
-
if (
|
228
|
+
if (rxml_xpath_object_empty_q(self) == Qtrue)
|
243
229
|
return INT2FIX(0);
|
244
230
|
|
245
231
|
Data_Get_Struct(self,xmlXPathObject,xpop);
|
@@ -266,8 +252,8 @@ ruby_xml_xpath_object_length(VALUE self) {
|
|
266
252
|
* * XML::XPath::USERS
|
267
253
|
* * XML::XPath::XSLT_TREE
|
268
254
|
*/
|
269
|
-
VALUE
|
270
|
-
|
255
|
+
static VALUE
|
256
|
+
rxml_xpath_object_get_type(VALUE self)
|
271
257
|
{
|
272
258
|
xmlXPathObjectPtr xpop;
|
273
259
|
|
@@ -283,8 +269,8 @@ ruby_xml_xpath_object_get_type(VALUE self)
|
|
283
269
|
*
|
284
270
|
* Returns the original XPath expression as a string.
|
285
271
|
*/
|
286
|
-
VALUE
|
287
|
-
|
272
|
+
static VALUE
|
273
|
+
rxml_xpath_object_string(VALUE self)
|
288
274
|
{
|
289
275
|
xmlXPathObjectPtr xpop;
|
290
276
|
|
@@ -303,8 +289,8 @@ ruby_xml_xpath_object_string(VALUE self)
|
|
303
289
|
* Dump libxml debugging information to stdout.
|
304
290
|
* Requires Libxml be compiled with debugging enabled.
|
305
291
|
*/
|
306
|
-
VALUE
|
307
|
-
|
292
|
+
static VALUE
|
293
|
+
rxml_xpath_object_debug(VALUE self) {
|
308
294
|
xmlXPathObjectPtr xpop;
|
309
295
|
|
310
296
|
#ifndef LIBXML_DEBUG_ENABLED
|
@@ -321,14 +307,14 @@ ruby_init_xml_xpath_object(void) {
|
|
321
307
|
cXMLXPathObject = rb_define_class_under(mXPath, "Object", rb_cObject);
|
322
308
|
rb_include_module(cXMLXPathObject, rb_mEnumerable);
|
323
309
|
rb_define_attr(cXMLXPathObject, "context", 1, 0);
|
324
|
-
rb_define_method(cXMLXPathObject, "each",
|
325
|
-
rb_define_method(cXMLXPathObject, "xpath_type",
|
326
|
-
rb_define_method(cXMLXPathObject, "empty?",
|
327
|
-
rb_define_method(cXMLXPathObject, "first",
|
328
|
-
rb_define_method(cXMLXPathObject, "length",
|
329
|
-
rb_define_method(cXMLXPathObject, "size",
|
330
|
-
rb_define_method(cXMLXPathObject, "to_a",
|
331
|
-
rb_define_method(cXMLXPathObject, "[]",
|
332
|
-
rb_define_method(cXMLXPathObject, "string",
|
333
|
-
rb_define_method(cXMLXPathObject, "debug",
|
310
|
+
rb_define_method(cXMLXPathObject, "each", rxml_xpath_object_each, 0);
|
311
|
+
rb_define_method(cXMLXPathObject, "xpath_type", rxml_xpath_object_get_type, 0);
|
312
|
+
rb_define_method(cXMLXPathObject, "empty?", rxml_xpath_object_empty_q, 0);
|
313
|
+
rb_define_method(cXMLXPathObject, "first", rxml_xpath_object_first, 0);
|
314
|
+
rb_define_method(cXMLXPathObject, "length", rxml_xpath_object_length, 0);
|
315
|
+
rb_define_method(cXMLXPathObject, "size", rxml_xpath_object_length, 0);
|
316
|
+
rb_define_method(cXMLXPathObject, "to_a", rxml_xpath_object_to_a, 0);
|
317
|
+
rb_define_method(cXMLXPathObject, "[]", rxml_xpath_object_aref, 1);
|
318
|
+
rb_define_method(cXMLXPathObject, "string", rxml_xpath_object_string, 0);
|
319
|
+
rb_define_method(cXMLXPathObject, "debug", rxml_xpath_object_debug, 0);
|
334
320
|
}
|
@@ -1,22 +1,11 @@
|
|
1
1
|
/* $Id $ */
|
2
2
|
|
3
|
-
#ifndef
|
4
|
-
#define
|
3
|
+
#ifndef __rxml_XPATH_OBJECT__
|
4
|
+
#define __rxml_XPATH_OBJECT__
|
5
5
|
|
6
6
|
extern VALUE cXMLXPathObject;
|
7
7
|
|
8
|
-
typedef struct ruby_xml_xpath_object_s {
|
9
|
-
xmlXPathObjectPtr xpop;
|
10
|
-
} ruby_xml_xpath_object;
|
11
|
-
|
12
8
|
void ruby_init_xml_xpath_object(void);
|
13
|
-
VALUE
|
14
|
-
|
15
|
-
VALUE ruby_xml_xpath_object_first(VALUE self);
|
16
|
-
VALUE ruby_xml_xpath_object_to_a(VALUE self);
|
17
|
-
VALUE ruby_xml_xpath_object_each(VALUE self);
|
18
|
-
VALUE ruby_xml_xpath_object_empty_q(VALUE self);
|
19
|
-
VALUE ruby_xml_xpath_object_first(VALUE self);
|
20
|
-
VALUE ruby_xml_xpath_object_length(VALUE self);
|
9
|
+
VALUE rxml_xpath_object_wrap(xmlXPathObjectPtr xpop);
|
21
10
|
|
22
11
|
#endif
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: ruby_xml_xpointer.c
|
1
|
+
/* $Id: ruby_xml_xpointer.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
|
|
@@ -16,8 +16,8 @@ VALUE cXMLXPointer;
|
|
16
16
|
*/
|
17
17
|
|
18
18
|
|
19
|
-
VALUE
|
20
|
-
|
19
|
+
static VALUE
|
20
|
+
rxml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str) {
|
21
21
|
#ifdef LIBXML_XPTR_ENABLED
|
22
22
|
xmlNodePtr xnode;
|
23
23
|
xmlXPathContextPtr xctxt;
|
@@ -39,9 +39,9 @@ ruby_xml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str) {
|
|
39
39
|
|
40
40
|
xpop = xmlXPtrEval((xmlChar*)StringValuePtr(xptr_str), xctxt);
|
41
41
|
if (!xpop)
|
42
|
-
|
42
|
+
rxml_raise(&xmlLastError);
|
43
43
|
|
44
|
-
result =
|
44
|
+
result = rxml_xpath_object_wrap(xpop);
|
45
45
|
rb_iv_set(result, "@context", context);
|
46
46
|
|
47
47
|
return(result);
|
@@ -51,10 +51,9 @@ ruby_xml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str) {
|
|
51
51
|
#endif
|
52
52
|
}
|
53
53
|
|
54
|
-
|
55
54
|
VALUE
|
56
|
-
|
57
|
-
return(
|
55
|
+
rxml_xpointer_point2(VALUE node, VALUE xptr_str) {
|
56
|
+
return(rxml_xpointer_point(cXMLXPointer, node, xptr_str));
|
58
57
|
}
|
59
58
|
|
60
59
|
|
@@ -65,8 +64,8 @@ ruby_xml_xpointer_point2(VALUE node, VALUE xptr_str) {
|
|
65
64
|
* Create an xpath representing the range between the supplied
|
66
65
|
* start and end node.
|
67
66
|
*/
|
68
|
-
VALUE
|
69
|
-
|
67
|
+
static VALUE
|
68
|
+
rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend) {
|
70
69
|
#ifdef LIBXML_XPTR_ENABLED
|
71
70
|
xmlNodePtr start, end;
|
72
71
|
VALUE rxxp;
|
@@ -89,7 +88,7 @@ ruby_xml_xpointer_range(VALUE class, VALUE rstart, VALUE rend) {
|
|
89
88
|
if (xpath == NULL)
|
90
89
|
rb_fatal("You shouldn't be able to have this happen");
|
91
90
|
|
92
|
-
rxxp =
|
91
|
+
rxxp = rxml_xpath_object_wrap(xpath);
|
93
92
|
return(rxxp);
|
94
93
|
#else
|
95
94
|
rb_warn("libxml was compiled without XPointer support");
|
@@ -106,5 +105,5 @@ ruby_xml_xpointer_range(VALUE class, VALUE rstart, VALUE rend) {
|
|
106
105
|
void
|
107
106
|
ruby_init_xml_xpointer(void) {
|
108
107
|
cXMLXPointer = rb_define_class_under(mXML, "XPointer", rb_cObject);
|
109
|
-
rb_define_singleton_method(cXMLXPointer, "range",
|
108
|
+
rb_define_singleton_method(cXMLXPointer, "range", rxml_xpointer_range, 2);
|
110
109
|
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
/* $Id: ruby_xml_xpointer.h
|
1
|
+
/* $Id: ruby_xml_xpointer.h 614 2008-11-22 08:04:39Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
5
|
-
#ifndef
|
6
|
-
#define
|
5
|
+
#ifndef __rxml_XPOINTER__
|
6
|
+
#define __rxml_XPOINTER__
|
7
7
|
|
8
8
|
extern VALUE cXMLXPointer;
|
9
9
|
extern VALUE eXMLXPointerInvalidExpression;
|
10
10
|
|
11
|
-
typedef struct
|
11
|
+
typedef struct rxml_xpointer {
|
12
12
|
VALUE xd;
|
13
13
|
VALUE ctxt;
|
14
14
|
/*
|
@@ -18,10 +18,8 @@ typedef struct ruby_xml_xpointer {
|
|
18
18
|
*
|
19
19
|
* I also need an xpointer data struct type.
|
20
20
|
*/
|
21
|
-
}
|
21
|
+
} rxml_xpointer;
|
22
22
|
|
23
|
-
VALUE ruby_xml_xpointer_point(VALUE class, VALUE node, VALUE xptr_string);
|
24
|
-
VALUE ruby_xml_xpointer_point2(VALUE node, VALUE xptr_string);
|
25
23
|
void ruby_init_xml_xpointer(void);
|
26
24
|
|
27
25
|
#endif
|