libxml-ruby 3.2.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY +5 -0
- data/ext/libxml/libxml.c +0 -1
- data/ext/libxml/libxml_ruby.def +0 -1
- data/ext/libxml/ruby_libxml.h +0 -1
- data/ext/libxml/ruby_xml.c +1 -1
- data/ext/libxml/ruby_xml.h +1 -1
- data/ext/libxml/ruby_xml_cbg.c +1 -1
- data/ext/libxml/ruby_xml_dtd.c +1 -1
- data/ext/libxml/ruby_xml_encoding.c +1 -1
- data/ext/libxml/ruby_xml_error.c +2 -2
- data/ext/libxml/ruby_xml_error.h +1 -1
- data/ext/libxml/ruby_xml_input_cbg.c +1 -1
- data/ext/libxml/ruby_xml_io.c +1 -1
- data/ext/libxml/ruby_xml_node.c +0 -12
- data/ext/libxml/ruby_xml_version.h +5 -5
- data/lib/libxml-ruby.rb +1 -1
- metadata +3 -11
- data/MANIFEST +0 -166
- data/ext/libxml/ruby_xml_xpointer.c +0 -103
- data/ext/libxml/ruby_xml_xpointer.h +0 -11
- data/setup.rb +0 -1584
- data/test/test_suite.rb +0 -48
- data/test/test_xpointer.rb +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30b8d15c0c7e89faa19b317afbca0d4f4b575ac452a625d3c4e9990cffda68c5
|
4
|
+
data.tar.gz: 2aa2fb69b81a258ee9c94bbd8d8ef0c79183e2258ecb9ad962b4e4384719c79b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86bfba334a01441d4805f099111428c79b35715ed5abe758dee67ff01ff51fb0cc086837631065561f7e157f9b1a682ea10bfb4ca015995bd5cef430c62b0a3e
|
7
|
+
data.tar.gz: e4879c9c500eecfc1a828482d72d5f3f86f977eeb02dc111d15498744a363b87ea01b2c44baaec262755276d6c19442da3195c6f728baa0ef3153f8d683666e1
|
data/HISTORY
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= Release History
|
2
2
|
|
3
|
+
== 4.0.0 / 2022-12-28
|
4
|
+
|
5
|
+
* Breaking - Remove support for XPointer since libxml2 has deprecated it and will remove it (Charlie Savage)
|
6
|
+
* Breaking - Remove support for ancient setup.rb script (Charlie Savage)
|
7
|
+
|
3
8
|
== 3.2.4 / 2022-10-29
|
4
9
|
|
5
10
|
* Support libxml2 version 2.10.2 (Charlie Savage)
|
data/ext/libxml/libxml.c
CHANGED
data/ext/libxml/libxml_ruby.def
CHANGED
data/ext/libxml/ruby_libxml.h
CHANGED
data/ext/libxml/ruby_xml.c
CHANGED
data/ext/libxml/ruby_xml.h
CHANGED
data/ext/libxml/ruby_xml_cbg.c
CHANGED
data/ext/libxml/ruby_xml_dtd.c
CHANGED
@@ -235,7 +235,7 @@ static VALUE rxml_dtd_initialize(int argc, VALUE *argv, VALUE self)
|
|
235
235
|
return self;
|
236
236
|
}
|
237
237
|
|
238
|
-
void rxml_init_dtd()
|
238
|
+
void rxml_init_dtd(void)
|
239
239
|
{
|
240
240
|
cXMLDtd = rb_define_class_under(mXML, "Dtd", rb_cObject);
|
241
241
|
rb_define_alloc_func(cXMLDtd, rxml_dtd_alloc);
|
@@ -182,7 +182,7 @@ rb_encoding* rxml_figure_encoding(const xmlChar* xencoding)
|
|
182
182
|
VALUE rxml_new_cstr(const xmlChar* xstr, const xmlChar* xencoding)
|
183
183
|
{
|
184
184
|
rb_encoding *rbencoding = rxml_figure_encoding(xencoding);
|
185
|
-
return rb_external_str_new_with_enc((const char*)xstr, strlen((const char*)xstr), rbencoding);
|
185
|
+
return rb_external_str_new_with_enc((const char*)xstr, (long)strlen((const char*)xstr), rbencoding);
|
186
186
|
}
|
187
187
|
|
188
188
|
VALUE rxml_new_cstr_len(const xmlChar* xstr, const long length, const xmlChar* xencoding)
|
data/ext/libxml/ruby_xml_error.c
CHANGED
@@ -44,7 +44,7 @@ static ID ERROR_HANDLER_ID;
|
|
44
44
|
* Returns the proc that will be called when libxml generates
|
45
45
|
* warning, error or fatal error messages.
|
46
46
|
*/
|
47
|
-
static VALUE rxml_error_get_handler()
|
47
|
+
static VALUE rxml_error_get_handler(void)
|
48
48
|
{
|
49
49
|
VALUE block = rb_cvar_get(eXMLError, ERROR_HANDLER_ID);
|
50
50
|
return block;
|
@@ -165,7 +165,7 @@ NORETURN(void rxml_raise(xmlErrorPtr xerror))
|
|
165
165
|
rb_exc_raise(error);
|
166
166
|
}
|
167
167
|
|
168
|
-
void rxml_init_error()
|
168
|
+
void rxml_init_error(void)
|
169
169
|
{
|
170
170
|
CALL_METHOD = rb_intern("call");
|
171
171
|
ERROR_HANDLER_ID = rb_intern("@@__error_handler_callback__");
|
data/ext/libxml/ruby_xml_error.h
CHANGED
@@ -88,7 +88,7 @@ int ic_close(void *context)
|
|
88
88
|
*
|
89
89
|
* Register a new set of I/O callback for handling parser input.
|
90
90
|
*/
|
91
|
-
static VALUE input_callbacks_register_input_callbacks()
|
91
|
+
static VALUE input_callbacks_register_input_callbacks(void)
|
92
92
|
{
|
93
93
|
xmlRegisterInputCallbacks(ic_match, ic_open, ic_read, ic_close);
|
94
94
|
return (Qtrue);
|
data/ext/libxml/ruby_xml_io.c
CHANGED
@@ -30,7 +30,7 @@ int rxml_write_callback(VALUE io, const char *buffer, int len)
|
|
30
30
|
{
|
31
31
|
// Could be StringIO
|
32
32
|
VALUE written, string;
|
33
|
-
string = rb_external_str_new_with_enc(buffer, strlen(buffer), rb_enc_get(io));
|
33
|
+
string = rb_external_str_new_with_enc(buffer, (long)strlen(buffer), rb_enc_get(io));
|
34
34
|
written = rb_funcall(io, WRITE_METHOD, 1, string);
|
35
35
|
return NUM2INT(written);
|
36
36
|
}
|
data/ext/libxml/ruby_xml_node.c
CHANGED
@@ -1001,17 +1001,6 @@ static VALUE rxml_node_path(VALUE self)
|
|
1001
1001
|
return result;
|
1002
1002
|
}
|
1003
1003
|
|
1004
|
-
/*
|
1005
|
-
* call-seq:
|
1006
|
-
* node.pointer -> XML::NodeSet
|
1007
|
-
*
|
1008
|
-
* Evaluates an XPointer expression relative to this node.
|
1009
|
-
*/
|
1010
|
-
static VALUE rxml_node_pointer(VALUE self, VALUE xptr_str)
|
1011
|
-
{
|
1012
|
-
return (rxml_xpointer_point2(self, xptr_str));
|
1013
|
-
}
|
1014
|
-
|
1015
1004
|
/*
|
1016
1005
|
* call-seq:
|
1017
1006
|
* node.prev -> XML::Node
|
@@ -1397,7 +1386,6 @@ void rxml_init_node(void)
|
|
1397
1386
|
rb_define_method(cXMLNode, "output_escaping?", rxml_node_output_escaping_q, 0);
|
1398
1387
|
rb_define_method(cXMLNode, "output_escaping=", rxml_node_output_escaping_set, 1);
|
1399
1388
|
rb_define_method(cXMLNode, "path", rxml_node_path, 0);
|
1400
|
-
rb_define_method(cXMLNode, "pointer", rxml_node_pointer, 1);
|
1401
1389
|
rb_define_method(cXMLNode, "remove!", rxml_node_remove_ex, 0);
|
1402
1390
|
rb_define_method(cXMLNode, "space_preserve", rxml_node_space_preserve_get, 0);
|
1403
1391
|
rb_define_method(cXMLNode, "space_preserve=", rxml_node_space_preserve_set, 1);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/* Don't nuke this block! It is used for automatically updating the
|
2
2
|
* versions below. VERSION = string formatting, VERNUM = numbered
|
3
3
|
* version for inline testing: increment both or none at all.*/
|
4
|
-
#define RUBY_LIBXML_VERSION "
|
5
|
-
#define RUBY_LIBXML_VERNUM
|
6
|
-
#define RUBY_LIBXML_VER_MAJ
|
7
|
-
#define RUBY_LIBXML_VER_MIN
|
8
|
-
#define RUBY_LIBXML_VER_MIC
|
4
|
+
#define RUBY_LIBXML_VERSION "4.0.0"
|
5
|
+
#define RUBY_LIBXML_VERNUM 400
|
6
|
+
#define RUBY_LIBXML_VER_MAJ 4
|
7
|
+
#define RUBY_LIBXML_VER_MIN 0
|
8
|
+
#define RUBY_LIBXML_VER_MIC 0
|
9
9
|
#define RUBY_LIBXML_VER_PATCH 0
|
data/lib/libxml-ruby.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libxml-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Bamform
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2022-
|
17
|
+
date: 2022-12-28 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rake-compiler
|
@@ -58,7 +58,6 @@ extra_rdoc_files: []
|
|
58
58
|
files:
|
59
59
|
- HISTORY
|
60
60
|
- LICENSE
|
61
|
-
- MANIFEST
|
62
61
|
- README.rdoc
|
63
62
|
- Rakefile
|
64
63
|
- ext/libxml/extconf.h
|
@@ -136,8 +135,6 @@ files:
|
|
136
135
|
- ext/libxml/ruby_xml_xpath_expression.h
|
137
136
|
- ext/libxml/ruby_xml_xpath_object.c
|
138
137
|
- ext/libxml/ruby_xml_xpath_object.h
|
139
|
-
- ext/libxml/ruby_xml_xpointer.c
|
140
|
-
- ext/libxml/ruby_xml_xpointer.h
|
141
138
|
- ext/vc/libxml_ruby.sln
|
142
139
|
- lib/libxml-ruby.rb
|
143
140
|
- lib/libxml.rb
|
@@ -168,7 +165,6 @@ files:
|
|
168
165
|
- script/benchmark/sock_entries.xml
|
169
166
|
- script/benchmark/throughput
|
170
167
|
- script/test
|
171
|
-
- setup.rb
|
172
168
|
- test/c14n/given/doc.dtd
|
173
169
|
- test/c14n/given/example-1.xml
|
174
170
|
- test/c14n/given/example-2.xml
|
@@ -252,7 +248,6 @@ files:
|
|
252
248
|
- test/test_relaxng.rb
|
253
249
|
- test/test_sax_parser.rb
|
254
250
|
- test/test_schema.rb
|
255
|
-
- test/test_suite.rb
|
256
251
|
- test/test_traversal.rb
|
257
252
|
- test/test_writer.rb
|
258
253
|
- test/test_xinclude.rb
|
@@ -260,7 +255,6 @@ files:
|
|
260
255
|
- test/test_xpath.rb
|
261
256
|
- test/test_xpath_context.rb
|
262
257
|
- test/test_xpath_expression.rb
|
263
|
-
- test/test_xpointer.rb
|
264
258
|
homepage: https://xml4r.github.io/libxml-ruby/
|
265
259
|
licenses:
|
266
260
|
- MIT
|
@@ -280,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
274
|
- !ruby/object:Gem::Version
|
281
275
|
version: '0'
|
282
276
|
requirements: []
|
283
|
-
rubygems_version: 3.3.
|
277
|
+
rubygems_version: 3.3.26
|
284
278
|
signing_key:
|
285
279
|
specification_version: 4
|
286
280
|
summary: Ruby Bindings for LibXML2
|
@@ -317,7 +311,6 @@ test_files:
|
|
317
311
|
- test/test_relaxng.rb
|
318
312
|
- test/test_sax_parser.rb
|
319
313
|
- test/test_schema.rb
|
320
|
-
- test/test_suite.rb
|
321
314
|
- test/test_traversal.rb
|
322
315
|
- test/test_writer.rb
|
323
316
|
- test/test_xinclude.rb
|
@@ -325,4 +318,3 @@ test_files:
|
|
325
318
|
- test/test_xpath.rb
|
326
319
|
- test/test_xpath_context.rb
|
327
320
|
- test/test_xpath_expression.rb
|
328
|
-
- test/test_xpointer.rb
|
data/MANIFEST
DELETED
@@ -1,166 +0,0 @@
|
|
1
|
-
#!mast -x doc/libxml-ruby/rdoc -i .gitignore ext doc lib script test [A-Z]*
|
2
|
-
ext/libxml/extconf.rb
|
3
|
-
ext/libxml/libxml.c
|
4
|
-
ext/libxml/ruby_libxml.h
|
5
|
-
ext/libxml/ruby_xml.c
|
6
|
-
ext/libxml/ruby_xml.h
|
7
|
-
ext/libxml/ruby_xml_attr.c
|
8
|
-
ext/libxml/ruby_xml_attr.h
|
9
|
-
ext/libxml/ruby_xml_attr_decl.c
|
10
|
-
ext/libxml/ruby_xml_attr_decl.h
|
11
|
-
ext/libxml/ruby_xml_attributes.c
|
12
|
-
ext/libxml/ruby_xml_attributes.h
|
13
|
-
ext/libxml/ruby_xml_cbg.c
|
14
|
-
ext/libxml/ruby_xml_document.c
|
15
|
-
ext/libxml/ruby_xml_document.h
|
16
|
-
ext/libxml/ruby_xml_dtd.c
|
17
|
-
ext/libxml/ruby_xml_dtd.h
|
18
|
-
ext/libxml/ruby_xml_encoding.c
|
19
|
-
ext/libxml/ruby_xml_encoding.h
|
20
|
-
ext/libxml/ruby_xml_error.c
|
21
|
-
ext/libxml/ruby_xml_error.h
|
22
|
-
ext/libxml/ruby_xml_html_parser.c
|
23
|
-
ext/libxml/ruby_xml_html_parser.h
|
24
|
-
ext/libxml/ruby_xml_html_parser_context.c
|
25
|
-
ext/libxml/ruby_xml_html_parser_context.h
|
26
|
-
ext/libxml/ruby_xml_html_parser_options.c
|
27
|
-
ext/libxml/ruby_xml_html_parser_options.h
|
28
|
-
ext/libxml/ruby_xml_input_cbg.c
|
29
|
-
ext/libxml/ruby_xml_input_cbg.h
|
30
|
-
ext/libxml/ruby_xml_io.c
|
31
|
-
ext/libxml/ruby_xml_io.h
|
32
|
-
ext/libxml/ruby_xml_namespace.c
|
33
|
-
ext/libxml/ruby_xml_namespace.h
|
34
|
-
ext/libxml/ruby_xml_namespaces.c
|
35
|
-
ext/libxml/ruby_xml_namespaces.h
|
36
|
-
ext/libxml/ruby_xml_node.c
|
37
|
-
ext/libxml/ruby_xml_node.h
|
38
|
-
ext/libxml/ruby_xml_parser.c
|
39
|
-
ext/libxml/ruby_xml_parser.h
|
40
|
-
ext/libxml/ruby_xml_parser_context.c
|
41
|
-
ext/libxml/ruby_xml_parser_context.h
|
42
|
-
ext/libxml/ruby_xml_parser_options.c
|
43
|
-
ext/libxml/ruby_xml_parser_options.h
|
44
|
-
ext/libxml/ruby_xml_reader.c
|
45
|
-
ext/libxml/ruby_xml_reader.h
|
46
|
-
ext/libxml/ruby_xml_relaxng.c
|
47
|
-
ext/libxml/ruby_xml_relaxng.h
|
48
|
-
ext/libxml/ruby_xml_sax2_handler.c
|
49
|
-
ext/libxml/ruby_xml_sax2_handler.h
|
50
|
-
ext/libxml/ruby_xml_sax_parser.c
|
51
|
-
ext/libxml/ruby_xml_sax_parser.h
|
52
|
-
ext/libxml/ruby_xml_schema.c
|
53
|
-
ext/libxml/ruby_xml_schema.h
|
54
|
-
ext/libxml/ruby_xml_version.h
|
55
|
-
ext/libxml/ruby_xml_xinclude.c
|
56
|
-
ext/libxml/ruby_xml_xinclude.h
|
57
|
-
ext/libxml/ruby_xml_xpath.c
|
58
|
-
ext/libxml/ruby_xml_xpath.h
|
59
|
-
ext/libxml/ruby_xml_xpath_context.c
|
60
|
-
ext/libxml/ruby_xml_xpath_context.h
|
61
|
-
ext/libxml/ruby_xml_xpath_expression.c
|
62
|
-
ext/libxml/ruby_xml_xpath_expression.h
|
63
|
-
ext/libxml/ruby_xml_xpath_object.c
|
64
|
-
ext/libxml/ruby_xml_xpath_object.h
|
65
|
-
ext/libxml/ruby_xml_xpointer.c
|
66
|
-
ext/libxml/ruby_xml_xpointer.h
|
67
|
-
ext/mingw/Rakefile
|
68
|
-
ext/mingw/build.rake
|
69
|
-
ext/mingw/libiconv-2.dll
|
70
|
-
ext/mingw/libxml2-2.dll
|
71
|
-
ext/mingw/libxml_ruby.dll.a
|
72
|
-
ext/mingw/libxml_ruby.so
|
73
|
-
ext/vc/libxml_ruby.sln
|
74
|
-
ext/vc/libxml_ruby_18/libxml_ruby.vcproj
|
75
|
-
ext/vc/libxml_ruby_19/libxml_ruby_19.vcproj
|
76
|
-
doc/.htaccess
|
77
|
-
doc/.rsync-filter
|
78
|
-
lib/libxml/attr.rb
|
79
|
-
lib/libxml/attr_decl.rb
|
80
|
-
lib/libxml/attributes.rb
|
81
|
-
lib/libxml/document.rb
|
82
|
-
lib/libxml/error.rb
|
83
|
-
lib/libxml/hpricot.rb
|
84
|
-
lib/libxml/html_parser.rb
|
85
|
-
lib/libxml/namespace.rb
|
86
|
-
lib/libxml/namespaces.rb
|
87
|
-
lib/libxml/node.rb
|
88
|
-
lib/libxml/ns.rb
|
89
|
-
lib/libxml/parser.rb
|
90
|
-
lib/libxml/properties.rb
|
91
|
-
lib/libxml/reader.rb
|
92
|
-
lib/libxml/sax_callbacks.rb
|
93
|
-
lib/libxml/sax_parser.rb
|
94
|
-
lib/libxml/tree.rb
|
95
|
-
lib/libxml/xpath_object.rb
|
96
|
-
lib/libxml.rb
|
97
|
-
lib/xml/libxml.rb
|
98
|
-
lib/xml.rb
|
99
|
-
script/benchmark/depixelate
|
100
|
-
script/benchmark/hamlet.xml
|
101
|
-
script/benchmark/parsecount
|
102
|
-
script/benchmark/sock_entries.xml
|
103
|
-
script/benchmark/throughput
|
104
|
-
script/test
|
105
|
-
test/etc_doc_to_s.rb
|
106
|
-
test/ets_doc_file.rb
|
107
|
-
test/ets_doc_to_s.rb
|
108
|
-
test/ets_gpx.rb
|
109
|
-
test/ets_node_gc.rb
|
110
|
-
test/ets_test.xml
|
111
|
-
test/ets_tsr.rb
|
112
|
-
test/model/atom.xml
|
113
|
-
test/model/bands.xml
|
114
|
-
test/model/books.xml
|
115
|
-
test/model/merge_bug_data.xml
|
116
|
-
test/model/ruby-lang.html
|
117
|
-
test/model/rubynet.xml
|
118
|
-
test/model/rubynet_project
|
119
|
-
test/model/shiporder.rnc
|
120
|
-
test/model/shiporder.rng
|
121
|
-
test/model/shiporder.xml
|
122
|
-
test/model/shiporder.xsd
|
123
|
-
test/model/soap.xml
|
124
|
-
test/model/xinclude.xml
|
125
|
-
test/test_attr.rb
|
126
|
-
test/test_attr_decl.rb
|
127
|
-
test/test_attributes.rb
|
128
|
-
test/test_deprecated_require.rb
|
129
|
-
test/test_document.rb
|
130
|
-
test/test_document_write.rb
|
131
|
-
test/test_dtd.rb
|
132
|
-
test/test_error.rb
|
133
|
-
test/test_html_parser.rb
|
134
|
-
test/test_namespace.rb
|
135
|
-
test/test_namespaces.rb
|
136
|
-
test/test_node.rb
|
137
|
-
test/test_node_cdata.rb
|
138
|
-
test/test_node_comment.rb
|
139
|
-
test/test_node_copy.rb
|
140
|
-
test/test_node_edit.rb
|
141
|
-
test/test_node_pi.rb
|
142
|
-
test/test_node_text.rb
|
143
|
-
test/test_node_write.rb
|
144
|
-
test/test_node_xlink.rb
|
145
|
-
test/test_parser.rb
|
146
|
-
test/test_parser_context.rb
|
147
|
-
test/test_properties.rb
|
148
|
-
test/test_reader.rb
|
149
|
-
test/test_relaxng.rb
|
150
|
-
test/test_sax_parser.rb
|
151
|
-
test/test_schema.rb
|
152
|
-
test/test_traversal.rb
|
153
|
-
test/test_xinclude.rb
|
154
|
-
test/test_xml.rb
|
155
|
-
test/test_xpath.rb
|
156
|
-
test/test_xpath_context.rb
|
157
|
-
test/test_xpath_expression.rb
|
158
|
-
test/test_xpointer.rb
|
159
|
-
test/test_suite.rb
|
160
|
-
Rakefile
|
161
|
-
HISTORY.rdoc
|
162
|
-
PROFILE
|
163
|
-
TODO
|
164
|
-
LICENSE
|
165
|
-
README.rdoc
|
166
|
-
VERSION
|
@@ -1,103 +0,0 @@
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
-
|
3
|
-
#include "ruby_libxml.h"
|
4
|
-
#include "ruby_xml_xpointer.h"
|
5
|
-
|
6
|
-
#ifdef LIBXML_XPTR_ENABLED
|
7
|
-
#include <libxml/xpointer.h>
|
8
|
-
#endif
|
9
|
-
|
10
|
-
VALUE cXMLXPointer;
|
11
|
-
|
12
|
-
/*
|
13
|
-
* Document-class: LibXML::XML::XPointer
|
14
|
-
*
|
15
|
-
* The XML::Pointer class provides a standards based API for searching an xml document.
|
16
|
-
* XPointer is based on the XML Path Language (XML::XPath) and is documented
|
17
|
-
* at http://www.w3.org/TR/WD-xptr.
|
18
|
-
*/
|
19
|
-
|
20
|
-
static VALUE rxml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str)
|
21
|
-
{
|
22
|
-
#ifdef LIBXML_XPTR_ENABLED
|
23
|
-
xmlNodePtr xnode;
|
24
|
-
xmlXPathContextPtr xctxt;
|
25
|
-
xmlXPathObjectPtr xpop;
|
26
|
-
|
27
|
-
VALUE context;
|
28
|
-
VALUE result;
|
29
|
-
VALUE argv[1];
|
30
|
-
|
31
|
-
Check_Type(xptr_str, T_STRING);
|
32
|
-
if (rb_obj_is_kind_of(rnode, cXMLNode) == Qfalse)
|
33
|
-
rb_raise(rb_eTypeError, "require an XML::Node object");
|
34
|
-
|
35
|
-
Data_Get_Struct(rnode, xmlNode, xnode);
|
36
|
-
|
37
|
-
argv[0] = rb_funcall(rnode, rb_intern("doc"), 0);
|
38
|
-
context = rb_class_new_instance(1, argv, cXMLXPathContext);
|
39
|
-
Data_Get_Struct(context, xmlXPathContext, xctxt);
|
40
|
-
|
41
|
-
xpop = xmlXPtrEval((xmlChar*)StringValuePtr(xptr_str), xctxt);
|
42
|
-
if (!xpop)
|
43
|
-
rxml_raise(&xmlLastError);
|
44
|
-
|
45
|
-
result = rxml_xpath_object_wrap(xnode->doc, xpop);
|
46
|
-
rb_iv_set(result, "@context", context);
|
47
|
-
|
48
|
-
return(result);
|
49
|
-
#else
|
50
|
-
rb_warn("libxml was compiled without XPointer support");
|
51
|
-
return (Qfalse);
|
52
|
-
#endif
|
53
|
-
}
|
54
|
-
|
55
|
-
VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str)
|
56
|
-
{
|
57
|
-
return (rxml_xpointer_point(cXMLXPointer, node, xptr_str));
|
58
|
-
}
|
59
|
-
|
60
|
-
/*
|
61
|
-
* call-seq:
|
62
|
-
* XML::XPointer.range(start_node, end_node) -> xpath
|
63
|
-
*
|
64
|
-
* Create an xpath representing the range between the supplied
|
65
|
-
* start and end node.
|
66
|
-
*/
|
67
|
-
static VALUE rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend)
|
68
|
-
{
|
69
|
-
#if defined LIBXML_XPTR_ENABLED && defined LIBXML_XPTR_LOCS_ENABLED
|
70
|
-
xmlNodePtr start, end;
|
71
|
-
VALUE rxxp;
|
72
|
-
xmlXPathObjectPtr xpath;
|
73
|
-
|
74
|
-
if (rb_obj_is_kind_of(rstart, cXMLNode) == Qfalse)
|
75
|
-
rb_raise(rb_eTypeError, "require an XML::Node object as a starting point");
|
76
|
-
if (rb_obj_is_kind_of(rend, cXMLNode) == Qfalse)
|
77
|
-
rb_raise(rb_eTypeError, "require an XML::Node object as an ending point");
|
78
|
-
|
79
|
-
Data_Get_Struct(rstart, xmlNode, start);
|
80
|
-
if (start == NULL)
|
81
|
-
return(Qnil);
|
82
|
-
|
83
|
-
Data_Get_Struct(rend, xmlNode, end);
|
84
|
-
if (end == NULL)
|
85
|
-
return(Qnil);
|
86
|
-
|
87
|
-
xpath = xmlXPtrNewRangeNodes(start, end);
|
88
|
-
if (xpath == NULL)
|
89
|
-
rb_fatal("You shouldn't be able to have this happen");
|
90
|
-
|
91
|
-
rxxp = rxml_xpath_object_wrap(start->doc, xpath);
|
92
|
-
return(rxxp);
|
93
|
-
#else
|
94
|
-
rb_warn("libxml was compiled without XPointer support");
|
95
|
-
return (Qfalse);
|
96
|
-
#endif
|
97
|
-
}
|
98
|
-
|
99
|
-
void rxml_init_xpointer(void)
|
100
|
-
{
|
101
|
-
cXMLXPointer = rb_define_class_under(mXML, "XPointer", rb_cObject);
|
102
|
-
rb_define_singleton_method(cXMLXPointer, "range", rxml_xpointer_range, 2);
|
103
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
-
|
3
|
-
#ifndef __RXML_XPOINTER__
|
4
|
-
#define __RXML_XPOINTER__
|
5
|
-
|
6
|
-
extern VALUE cXMLXPointer;
|
7
|
-
|
8
|
-
void rxml_init_xpointer(void);
|
9
|
-
VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str);
|
10
|
-
|
11
|
-
#endif
|