ruby-xml-smart 0.1.11-i486-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +4 -0
- data/COPYING +504 -0
- data/Changelog +192 -0
- data/README +52 -0
- data/Rakefile +112 -0
- data/TODO +6 -0
- data/examples/EXAMPLE.xml +17 -0
- data/examples/EXAMPLE.xml.sic +17 -0
- data/examples/Visualise/EXAMPLE.xml +18 -0
- data/examples/Visualise/term-ansicolor-0.0.4/CHANGES +11 -0
- data/examples/Visualise/term-ansicolor-0.0.4/GPL +340 -0
- data/examples/Visualise/term-ansicolor-0.0.4/README.en +23 -0
- data/examples/Visualise/term-ansicolor-0.0.4/Rakefile +72 -0
- data/examples/Visualise/term-ansicolor-0.0.4/VERSION +1 -0
- data/examples/Visualise/term-ansicolor-0.0.4/examples/cdiff.rb +20 -0
- data/examples/Visualise/term-ansicolor-0.0.4/examples/example.rb +82 -0
- data/examples/Visualise/term-ansicolor-0.0.4/install.rb +12 -0
- data/examples/Visualise/term-ansicolor-0.0.4/lib/term/ansicolor.rb +78 -0
- data/examples/Visualise/xpath_visual.rb +45 -0
- data/examples/add_children.rb +14 -0
- data/examples/add_elements.rb +13 -0
- data/examples/attrs.rb +15 -0
- data/examples/children.rb +14 -0
- data/examples/concurrent.rb +30 -0
- data/examples/copy.rb +23 -0
- data/examples/create.rb +18 -0
- data/examples/delete.rb +30 -0
- data/examples/move_elements.rb +12 -0
- data/examples/namespace.rb +14 -0
- data/examples/namespace_detailed.rb +36 -0
- data/examples/namespace_find.rb +20 -0
- data/examples/pull.rb +18 -0
- data/examples/qname.rb +16 -0
- data/examples/replace.rb +14 -0
- data/examples/set_OR_replace.rb +32 -0
- data/examples/signals.rb +28 -0
- data/examples/string.rb +27 -0
- data/examples/write.rb +11 -0
- data/examples/xpath_attrs.rb +19 -0
- data/examples/xpath_functions.rb +7 -0
- data/examples/xpath_root.rb +6 -0
- data/extconf.rb +29 -0
- data/rbxs.c +136 -0
- data/rbxs.h +53 -0
- data/rbxs_dom.c +483 -0
- data/rbxs_dom.h +32 -0
- data/rbxs_domattribute.c +189 -0
- data/rbxs_domattribute.h +18 -0
- data/rbxs_domattributeset.c +182 -0
- data/rbxs_domattributeset.h +17 -0
- data/rbxs_domelement.c +656 -0
- data/rbxs_domelement.h +18 -0
- data/rbxs_domnamespace.c +127 -0
- data/rbxs_domnamespace.h +18 -0
- data/rbxs_domnamespaceset.c +276 -0
- data/rbxs_domnamespaceset.h +17 -0
- data/rbxs_domnodeset.c +284 -0
- data/rbxs_domnodeset.h +19 -0
- data/rbxs_domother.c +121 -0
- data/rbxs_domother.h +18 -0
- data/rbxs_domtext.c +165 -0
- data/rbxs_domtext.h +18 -0
- data/rbxs_pull.c +244 -0
- data/rbxs_pull.h +17 -0
- data/rbxs_pullattribute.c +124 -0
- data/rbxs_pullattribute.h +18 -0
- data/rbxs_pullattributeset.c +156 -0
- data/rbxs_pullattributeset.h +17 -0
- data/rbxs_qname.c +267 -0
- data/rbxs_qname.h +18 -0
- data/rbxs_utils.h +39 -0
- data/test/namespace_test.rb +83 -0
- metadata +125 -0
data/rbxs_qname.c
ADDED
@@ -0,0 +1,267 @@
|
|
1
|
+
#include "rbxs_qname.h"
|
2
|
+
#include "rbxs_domelement.h"
|
3
|
+
#include "rbxs_pull.h"
|
4
|
+
|
5
|
+
/* -- */
|
6
|
+
//***********************************************************************************
|
7
|
+
// GC
|
8
|
+
//***********************************************************************************
|
9
|
+
void rbxs_qname_free(rbxs_qname *prbxs_qname) {
|
10
|
+
if (prbxs_qname != NULL) {
|
11
|
+
free(prbxs_qname);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
void rbxs_qname_mark(rbxs_qname *prbxs_qname) {
|
16
|
+
if (prbxs_qname == NULL) return;
|
17
|
+
if (!NIL_P(prbxs_qname->obj)) rb_gc_mark(prbxs_qname->obj);
|
18
|
+
}
|
19
|
+
|
20
|
+
//***********************************************************************************
|
21
|
+
// Methods
|
22
|
+
//***********************************************************************************
|
23
|
+
/* ++ */
|
24
|
+
|
25
|
+
/*
|
26
|
+
* Documentation
|
27
|
+
*/
|
28
|
+
VALUE rbxs_qname_inspect(VALUE self)
|
29
|
+
{
|
30
|
+
rbxs_qname *prbxs_qname;
|
31
|
+
rbxs_domelement *prbxs_domelement;
|
32
|
+
rbxs_pull *prbxs_pull;
|
33
|
+
unsigned char *ret;
|
34
|
+
VALUE *argv;
|
35
|
+
|
36
|
+
Data_Get_Struct(self, rbxs_qname, prbxs_qname);
|
37
|
+
switch (prbxs_qname->type) {
|
38
|
+
case RBXS_PARSER_TYPE_DOM:
|
39
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_domelement, prbxs_domelement);
|
40
|
+
if (prbxs_domelement->node->ns != NULL && prbxs_domelement->node->ns->prefix != NULL) {
|
41
|
+
argv = ALLOCA_N(VALUE, 5);
|
42
|
+
argv[0] = rb_str_new2("#<%s:0x%x \"%s:%s\">");
|
43
|
+
argv[1] = CLASS_OF(self);
|
44
|
+
argv[2] = rb_obj_id(self);
|
45
|
+
argv[3] = rb_str_new2((char *)prbxs_domelement->node->ns->prefix);
|
46
|
+
argv[4] = rb_str_new2((char *)prbxs_domelement->node->name);
|
47
|
+
return(rb_f_sprintf(5, argv));
|
48
|
+
} else {
|
49
|
+
argv = ALLOCA_N(VALUE, 4);
|
50
|
+
argv[0] = rb_str_new2("#<%s:0x%x \"%s\">");
|
51
|
+
argv[1] = CLASS_OF(self);
|
52
|
+
argv[2] = rb_obj_id(self);
|
53
|
+
argv[3] = rb_str_new2((char *)prbxs_domelement->node->name);
|
54
|
+
return(rb_f_sprintf(4, argv));
|
55
|
+
}
|
56
|
+
break;
|
57
|
+
case RBXS_PARSER_TYPE_READER:
|
58
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_pull, prbxs_pull);
|
59
|
+
ret = xmlTextReaderName(prbxs_pull->reader);
|
60
|
+
if (ret) {
|
61
|
+
argv = ALLOCA_N(VALUE, 4);
|
62
|
+
argv[0] = rb_str_new2("#<%s:0x%x \"%s\">");
|
63
|
+
argv[1] = CLASS_OF(self);
|
64
|
+
argv[2] = rb_obj_id(self);
|
65
|
+
argv[3] = rb_str_new2((char *)ret);
|
66
|
+
xmlFree(ret);
|
67
|
+
return(rb_f_sprintf(4, argv));
|
68
|
+
} else
|
69
|
+
return(Qnil);
|
70
|
+
}
|
71
|
+
return(Qnil);
|
72
|
+
}
|
73
|
+
|
74
|
+
/*
|
75
|
+
* Documentation
|
76
|
+
*/
|
77
|
+
VALUE rbxs_qname_to_s(VALUE self)
|
78
|
+
{
|
79
|
+
rbxs_qname *prbxs_qname;
|
80
|
+
rbxs_domelement *prbxs_domelement;
|
81
|
+
rbxs_pull *prbxs_pull;
|
82
|
+
unsigned char *ret;
|
83
|
+
VALUE *argv, val;
|
84
|
+
|
85
|
+
Data_Get_Struct(self, rbxs_qname, prbxs_qname);
|
86
|
+
switch (prbxs_qname->type) {
|
87
|
+
case RBXS_PARSER_TYPE_DOM:
|
88
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_domelement, prbxs_domelement);
|
89
|
+
if (prbxs_domelement->node->ns != NULL && prbxs_domelement->node->ns->prefix != NULL) {
|
90
|
+
argv = ALLOCA_N(VALUE, 3);
|
91
|
+
argv[0] = rb_str_new2("%s:%s");
|
92
|
+
argv[1] = rb_str_new2((char *)prbxs_domelement->node->ns->prefix);
|
93
|
+
argv[2] = rb_str_new2((char *)prbxs_domelement->node->name);
|
94
|
+
return(rb_f_sprintf(3, argv));
|
95
|
+
} else {
|
96
|
+
return rb_str_new2((char *)prbxs_domelement->node->name);
|
97
|
+
}
|
98
|
+
break;
|
99
|
+
case RBXS_PARSER_TYPE_READER:
|
100
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_pull, prbxs_pull);
|
101
|
+
ret = xmlTextReaderName(prbxs_pull->reader);
|
102
|
+
if (ret) {
|
103
|
+
val = rb_str_new2((char *)ret);
|
104
|
+
xmlFree(ret);
|
105
|
+
return(val);
|
106
|
+
} else
|
107
|
+
return(Qnil);
|
108
|
+
}
|
109
|
+
return(Qnil);
|
110
|
+
}
|
111
|
+
|
112
|
+
/*
|
113
|
+
* Documentation
|
114
|
+
*/
|
115
|
+
VALUE rbxs_qname_name(VALUE self)
|
116
|
+
{
|
117
|
+
rbxs_qname *prbxs_qname;
|
118
|
+
rbxs_domelement *prbxs_domelement;
|
119
|
+
rbxs_pull *prbxs_pull;
|
120
|
+
xmlChar *ret;
|
121
|
+
VALUE val;
|
122
|
+
|
123
|
+
Data_Get_Struct(self, rbxs_qname, prbxs_qname);
|
124
|
+
switch (prbxs_qname->type) {
|
125
|
+
case RBXS_PARSER_TYPE_DOM:
|
126
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_domelement, prbxs_domelement);
|
127
|
+
return(rb_str_new2((char *)prbxs_domelement->node->name));
|
128
|
+
case RBXS_PARSER_TYPE_READER:
|
129
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_pull, prbxs_pull);
|
130
|
+
ret = xmlTextReaderLocalName(prbxs_pull->reader);
|
131
|
+
if (ret) {
|
132
|
+
val = rb_str_new2((char *)ret);
|
133
|
+
xmlFree(ret);
|
134
|
+
return(val);
|
135
|
+
} else
|
136
|
+
return(Qnil);
|
137
|
+
}
|
138
|
+
return(Qnil);
|
139
|
+
}
|
140
|
+
|
141
|
+
/*
|
142
|
+
* Documentation
|
143
|
+
*/
|
144
|
+
VALUE rbxs_qname_streq(VALUE self,VALUE str)
|
145
|
+
{
|
146
|
+
rbxs_qname *prbxs_qname;
|
147
|
+
rbxs_domelement *prbxs_domelement;
|
148
|
+
rbxs_pull *prbxs_pull;
|
149
|
+
|
150
|
+
Data_Get_Struct(self, rbxs_qname, prbxs_qname);
|
151
|
+
Check_Type(str, T_STRING);
|
152
|
+
switch (prbxs_qname->type) {
|
153
|
+
case RBXS_PARSER_TYPE_DOM:
|
154
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_domelement, prbxs_domelement);
|
155
|
+
if (strcmp((char *)prbxs_domelement->node->name,StringValuePtr(str)) == 0)
|
156
|
+
return(Qtrue);
|
157
|
+
else
|
158
|
+
return(Qfalse);
|
159
|
+
case RBXS_PARSER_TYPE_READER:
|
160
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_pull, prbxs_pull);
|
161
|
+
if (strcmp((char *)xmlTextReaderLocalName(prbxs_pull->reader),StringValuePtr(str)) == 0)
|
162
|
+
return(Qtrue);
|
163
|
+
else
|
164
|
+
return(Qfalse);
|
165
|
+
}
|
166
|
+
return(Qnil);
|
167
|
+
}
|
168
|
+
|
169
|
+
/*
|
170
|
+
* Documentation
|
171
|
+
*/
|
172
|
+
VALUE rbxs_qname_prefix(VALUE self)
|
173
|
+
{
|
174
|
+
rbxs_qname *prbxs_qname;
|
175
|
+
rbxs_domelement *prbxs_domelement;
|
176
|
+
rbxs_pull *prbxs_pull;
|
177
|
+
xmlChar *ret;
|
178
|
+
VALUE val;
|
179
|
+
|
180
|
+
Data_Get_Struct(self, rbxs_qname, prbxs_qname);
|
181
|
+
switch (prbxs_qname->type) {
|
182
|
+
case RBXS_PARSER_TYPE_DOM:
|
183
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_domelement, prbxs_domelement);
|
184
|
+
if (prbxs_domelement->node->ns != NULL && prbxs_domelement->node->ns->prefix != NULL)
|
185
|
+
return(rb_str_new2((char *)prbxs_domelement->node->ns->prefix));
|
186
|
+
else
|
187
|
+
return(Qnil);
|
188
|
+
case RBXS_PARSER_TYPE_READER:
|
189
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_pull, prbxs_pull);
|
190
|
+
ret = xmlTextReaderPrefix(prbxs_pull->reader);
|
191
|
+
if (ret) {
|
192
|
+
val = rb_str_new2((char *)ret);
|
193
|
+
xmlFree(ret);
|
194
|
+
return(val);
|
195
|
+
} else
|
196
|
+
return(Qnil);
|
197
|
+
}
|
198
|
+
return Qnil;
|
199
|
+
}
|
200
|
+
|
201
|
+
/*
|
202
|
+
* Documentation
|
203
|
+
*/
|
204
|
+
VALUE rbxs_qname_namespace(VALUE self)
|
205
|
+
{
|
206
|
+
rbxs_qname *prbxs_qname;
|
207
|
+
rbxs_domelement *prbxs_domelement;
|
208
|
+
rbxs_pull *prbxs_pull;
|
209
|
+
xmlChar *ret;
|
210
|
+
VALUE val;
|
211
|
+
|
212
|
+
Data_Get_Struct(self, rbxs_qname, prbxs_qname);
|
213
|
+
switch (prbxs_qname->type) {
|
214
|
+
case RBXS_PARSER_TYPE_DOM:
|
215
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_domelement, prbxs_domelement);
|
216
|
+
if (prbxs_domelement->node->ns != NULL && prbxs_domelement->node->ns->prefix != NULL)
|
217
|
+
return(rb_str_new2((char *)prbxs_domelement->node->ns->href));
|
218
|
+
else
|
219
|
+
return(Qnil);
|
220
|
+
case RBXS_PARSER_TYPE_READER:
|
221
|
+
Data_Get_Struct(prbxs_qname->obj, rbxs_pull, prbxs_pull);
|
222
|
+
ret = xmlTextReaderNamespaceUri(prbxs_pull->reader);
|
223
|
+
if (ret) {
|
224
|
+
val = rb_str_new2((char *)ret);
|
225
|
+
xmlFree(ret);
|
226
|
+
return(val);
|
227
|
+
} else
|
228
|
+
return(Qnil);
|
229
|
+
}
|
230
|
+
return(Qnil);
|
231
|
+
}
|
232
|
+
|
233
|
+
//***********************************************************************************
|
234
|
+
// Constructors
|
235
|
+
//***********************************************************************************
|
236
|
+
VALUE rbxs_qname_new(VALUE class, VALUE obj, int type) {
|
237
|
+
rbxs_qname *prbxs_qname;
|
238
|
+
|
239
|
+
prbxs_qname = (rbxs_qname *)malloc(sizeof(rbxs_qname));
|
240
|
+
if (prbxs_qname == NULL )
|
241
|
+
rb_raise(rb_eNoMemError, "No memory left for XML::Smart::QName struct");
|
242
|
+
|
243
|
+
prbxs_qname->obj = obj;
|
244
|
+
prbxs_qname->type = type;
|
245
|
+
|
246
|
+
return(Data_Wrap_Struct(class, rbxs_qname_mark, rbxs_qname_free, prbxs_qname));
|
247
|
+
}
|
248
|
+
|
249
|
+
//***********************************************************************************
|
250
|
+
// Initialize class Node
|
251
|
+
//***********************************************************************************
|
252
|
+
#ifdef RDOC__
|
253
|
+
mXML = rb_define_module( "XML" );
|
254
|
+
cSmart = rb_define_class_under( mXML, "Smart", rb_cObject );
|
255
|
+
#endif
|
256
|
+
VALUE cSmartQName;
|
257
|
+
|
258
|
+
void init_rbxs_qname(void) {
|
259
|
+
cSmartQName = rb_define_class_under( cSmart, "QName", rb_cObject );
|
260
|
+
|
261
|
+
rb_define_method(cSmartQName, "inspect", rbxs_qname_inspect, 0);
|
262
|
+
rb_define_method(cSmartQName, "to_s", rbxs_qname_to_s, 0);
|
263
|
+
rb_define_method(cSmartQName, "==", rbxs_qname_streq, 1);
|
264
|
+
rb_define_method(cSmartQName, "name", rbxs_qname_name, 0);
|
265
|
+
rb_define_method(cSmartQName, "prefix", rbxs_qname_prefix, 0);
|
266
|
+
rb_define_method(cSmartQName, "namespace", rbxs_qname_namespace,0);
|
267
|
+
}
|
data/rbxs_qname.h
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
/* Please see the COPYING file for copyright and distribution information */
|
2
|
+
|
3
|
+
#ifndef __RBXS_QNAME_H__
|
4
|
+
#define __RBXS_QNAME_H__
|
5
|
+
|
6
|
+
#include "rbxs.h"
|
7
|
+
|
8
|
+
RUBY_EXTERN VALUE cSmartQName;
|
9
|
+
|
10
|
+
typedef struct rbxs_qname {
|
11
|
+
VALUE obj;
|
12
|
+
int type;
|
13
|
+
} rbxs_qname;
|
14
|
+
|
15
|
+
RUBY_EXTERN VALUE rbxs_qname_new(VALUE class, VALUE obj, int type);
|
16
|
+
RUBY_EXTERN void init_rbxs_qname(void);
|
17
|
+
|
18
|
+
#endif
|
data/rbxs_utils.h
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
/* Please see the COPYING file for copyright and distribution information */
|
2
|
+
|
3
|
+
#ifndef __RBXS_UTILS_H__
|
4
|
+
#define __RBXS_UTILS_H__
|
5
|
+
|
6
|
+
#include "rbxs.h"
|
7
|
+
|
8
|
+
//***********************************************************************************
|
9
|
+
// shamlessly copied from xmllint.c
|
10
|
+
//***********************************************************************************
|
11
|
+
xmlExternalEntityLoader defaultEntityLoader = NULL;
|
12
|
+
static xmlParserInputPtr xmllintExternalEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt) {
|
13
|
+
xmlParserInputPtr ret;
|
14
|
+
warningSAXFunc warning = NULL;
|
15
|
+
|
16
|
+
if ((ctxt != NULL) && (ctxt->sax != NULL)) {
|
17
|
+
warning = ctxt->sax->warning;
|
18
|
+
ctxt->sax->warning = NULL;
|
19
|
+
}
|
20
|
+
|
21
|
+
if (defaultEntityLoader != NULL) {
|
22
|
+
ret = defaultEntityLoader(URL, ID, ctxt);
|
23
|
+
if (ret != NULL) {
|
24
|
+
if (warning != NULL)
|
25
|
+
ctxt->sax->warning = warning;
|
26
|
+
return(ret);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
if (warning != NULL) {
|
30
|
+
ctxt->sax->warning = warning;
|
31
|
+
if (URL != NULL)
|
32
|
+
warning(ctxt, "failed to load external entity \"%s\"\n", URL);
|
33
|
+
else if (ID != NULL)
|
34
|
+
warning(ctxt, "failed to load external entity \"%s\"\n", ID);
|
35
|
+
}
|
36
|
+
return(NULL);
|
37
|
+
}
|
38
|
+
|
39
|
+
#endif
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'smart'
|
3
|
+
|
4
|
+
class NamespaceTest < Test::Unit::TestCase
|
5
|
+
BASE = "http://rbxs"
|
6
|
+
DEFAULT = "#{BASE}/default"
|
7
|
+
NS1 = "#{BASE}/ns1"
|
8
|
+
NS2 = "#{BASE}/ns2"
|
9
|
+
ADDED = "#{BASE}/added"
|
10
|
+
|
11
|
+
TEMPLATE = <<-EOT
|
12
|
+
<?xml version="1.0" encoding="utf-8"?>
|
13
|
+
<root xmlns:ns1="#{NS1}" xmlns="#{DEFAULT}">
|
14
|
+
<n1 xmlns="#{NS2}">
|
15
|
+
<n1s1 />
|
16
|
+
</n1>
|
17
|
+
<n2>
|
18
|
+
<ns1:n2s1 />
|
19
|
+
<n2s2 />
|
20
|
+
</n2>
|
21
|
+
<n3 xmlns="">
|
22
|
+
</n3>
|
23
|
+
</root>
|
24
|
+
EOT
|
25
|
+
|
26
|
+
TEMPLATE.sub!(/\A\s*/,'')
|
27
|
+
|
28
|
+
def setup
|
29
|
+
@doc = XML::Smart.string(TEMPLATE)
|
30
|
+
|
31
|
+
@root = @doc.root
|
32
|
+
@n1, @n2, @n3 = @root.children.to_a
|
33
|
+
|
34
|
+
@n1s1 = @n1.children.to_a
|
35
|
+
@n2s1, @n2s2 = @n2.children.to_a
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_namespaces
|
39
|
+
nss = @root.namespaces
|
40
|
+
assert_equal 2,nss.length
|
41
|
+
assert_equal NS1,nss["ns1"]
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_namespace
|
45
|
+
assert_equal DEFAULT,@root.namespace.href
|
46
|
+
assert_equal NS2,@n1.namespace.href
|
47
|
+
assert_equal DEFAULT,@n2.namespace.href
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_find_namespace
|
51
|
+
assert_nil @root.namespaces.find("x")
|
52
|
+
assert_not_nil NS1,@root.namespaces.find("ns1").href
|
53
|
+
assert_raises TypeError do
|
54
|
+
@n1.namespaces.find(nil).href
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_find_namespace_by_href
|
59
|
+
assert_nil @root.namespaces.find("http://blah")
|
60
|
+
assert_not_nil @root.namespaces.find(DEFAULT)
|
61
|
+
assert_not_nil @root.namespaces.find(NS1)
|
62
|
+
assert_nil @root.namespaces.find(NS2)
|
63
|
+
assert_not_nil @n1.namespaces.find(NS2)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_add_namespace
|
67
|
+
added_ns = @n2.namespaces["added"] = ADDED
|
68
|
+
n2s3 = @n2.add("s3")
|
69
|
+
n2s3.namespace = added_ns
|
70
|
+
assert_equal "<added:s3/>",n2s3.dump
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_find
|
74
|
+
assert_not_nil @root.find("//n3").first
|
75
|
+
|
76
|
+
assert_nil @root.find("//n1").first
|
77
|
+
assert_not_nil @root.find("//ns:n1","ns"=>NS2).first
|
78
|
+
|
79
|
+
assert_not_nil @root.find("//ns:n2s1","ns"=>NS1).first
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: ruby-xml-smart
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.11
|
7
|
+
date: 2008-08-22 00:00:00 +02:00
|
8
|
+
summary: easy to use and stable libxml2 binding
|
9
|
+
require_paths:
|
10
|
+
- .
|
11
|
+
email: juergen.mangler@univie.ac.at
|
12
|
+
homepage: http://raa.ruby-lang.org/project/ruby-xml-smart/
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire: smart
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.8.6
|
24
|
+
version:
|
25
|
+
platform: i486-linux
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
authors:
|
29
|
+
- "J\xC3\xBCrgen Mangler"
|
30
|
+
files:
|
31
|
+
- test
|
32
|
+
- rbxs_domattribute.c
|
33
|
+
- rbxs_domattribute.h
|
34
|
+
- rbxs_pullattribute.c
|
35
|
+
- rbxs_pullattribute.h
|
36
|
+
- rbxs_pullattributeset.c
|
37
|
+
- rbxs_pullattributeset.h
|
38
|
+
- Rakefile
|
39
|
+
- README
|
40
|
+
- rbxs_qname.c
|
41
|
+
- rbxs_qname.h
|
42
|
+
- rbxs_domnamespaceset.c
|
43
|
+
- rbxs_domnamespaceset.h
|
44
|
+
- rbxs_domnodeset.c
|
45
|
+
- rbxs_domnodeset.h
|
46
|
+
- rbxs_domtext.c
|
47
|
+
- rbxs_domtext.h
|
48
|
+
- rbxs_domnamespace.c
|
49
|
+
- rbxs_domnamespace.h
|
50
|
+
- rbxs.c
|
51
|
+
- rbxs.h
|
52
|
+
- rbxs_pull.c
|
53
|
+
- rbxs_pull.h
|
54
|
+
- rbxs_domelement.c
|
55
|
+
- rbxs_domelement.h
|
56
|
+
- rbxs_dom.c
|
57
|
+
- rbxs_dom.h
|
58
|
+
- AUTHORS
|
59
|
+
- rbxs_domattributeset.c
|
60
|
+
- rbxs_domattributeset.h
|
61
|
+
- examples
|
62
|
+
- rbxs_utils.h
|
63
|
+
- Changelog
|
64
|
+
- COPYING
|
65
|
+
- TODO
|
66
|
+
- rbxs_domother.c
|
67
|
+
- rbxs_domother.h
|
68
|
+
- extconf.rb
|
69
|
+
- test/namespace_test.rb
|
70
|
+
- examples/pull.rb
|
71
|
+
- examples/copy.rb
|
72
|
+
- examples/EXAMPLE.xml
|
73
|
+
- examples/Visualise
|
74
|
+
- examples/attrs.rb
|
75
|
+
- examples/string.rb
|
76
|
+
- examples/xpath_root.rb
|
77
|
+
- examples/xpath_functions.rb
|
78
|
+
- examples/add_elements.rb
|
79
|
+
- examples/add_children.rb
|
80
|
+
- examples/namespace_detailed.rb
|
81
|
+
- examples/move_elements.rb
|
82
|
+
- examples/EXAMPLE.xml.sic
|
83
|
+
- examples/namespace.rb
|
84
|
+
- examples/delete.rb
|
85
|
+
- examples/replace.rb
|
86
|
+
- examples/qname.rb
|
87
|
+
- examples/create.rb
|
88
|
+
- examples/set_OR_replace.rb
|
89
|
+
- examples/write.rb
|
90
|
+
- examples/xpath_attrs.rb
|
91
|
+
- examples/signals.rb
|
92
|
+
- examples/children.rb
|
93
|
+
- examples/namespace_find.rb
|
94
|
+
- examples/concurrent.rb
|
95
|
+
- examples/Visualise/EXAMPLE.xml
|
96
|
+
- examples/Visualise/xpath_visual.rb
|
97
|
+
- examples/Visualise/term-ansicolor-0.0.4
|
98
|
+
- examples/Visualise/term-ansicolor-0.0.4/GPL
|
99
|
+
- examples/Visualise/term-ansicolor-0.0.4/lib
|
100
|
+
- examples/Visualise/term-ansicolor-0.0.4/README.en
|
101
|
+
- examples/Visualise/term-ansicolor-0.0.4/Rakefile
|
102
|
+
- examples/Visualise/term-ansicolor-0.0.4/install.rb
|
103
|
+
- examples/Visualise/term-ansicolor-0.0.4/VERSION
|
104
|
+
- examples/Visualise/term-ansicolor-0.0.4/CHANGES
|
105
|
+
- examples/Visualise/term-ansicolor-0.0.4/examples
|
106
|
+
- examples/Visualise/term-ansicolor-0.0.4/lib/term
|
107
|
+
- examples/Visualise/term-ansicolor-0.0.4/lib/term/ansicolor.rb
|
108
|
+
- examples/Visualise/term-ansicolor-0.0.4/examples/example.rb
|
109
|
+
- examples/Visualise/term-ansicolor-0.0.4/examples/cdiff.rb
|
110
|
+
test_files:
|
111
|
+
- test/namespace_test.rb
|
112
|
+
rdoc_options:
|
113
|
+
- --charset=utf8
|
114
|
+
- --line-numbers
|
115
|
+
- --inline
|
116
|
+
extra_rdoc_files:
|
117
|
+
- README
|
118
|
+
executables: []
|
119
|
+
|
120
|
+
extensions:
|
121
|
+
- extconf.rb
|
122
|
+
requirements: []
|
123
|
+
|
124
|
+
dependencies: []
|
125
|
+
|