libxml-ruby 0.9.6-x86-mswin32-60 → 0.9.7-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +25 -3
- data/Rakefile +3 -4
- data/ext/libxml/cbg.c +86 -86
- data/ext/libxml/libxml.c +2 -1
- data/ext/libxml/ruby_libxml.h +1 -0
- data/ext/libxml/ruby_xml_document.c +3 -5
- data/ext/libxml/ruby_xml_error.c +37 -9
- data/ext/libxml/ruby_xml_error.h +1 -0
- data/ext/libxml/ruby_xml_namespace.c +158 -158
- data/ext/libxml/ruby_xml_node.c +1324 -1324
- data/ext/libxml/ruby_xml_sax2_handler.c +322 -0
- data/ext/libxml/ruby_xml_sax2_handler.h +12 -0
- data/ext/libxml/ruby_xml_sax_parser.c +12 -47
- data/ext/libxml/ruby_xml_xpath_context.c +354 -354
- data/ext/libxml/ruby_xml_xpointer.c +107 -107
- 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 +8 -0
- data/lib/libxml/node.rb +7 -2
- data/lib/libxml/sax_callbacks.rb +78 -90
- data/test/model/atom.xml +10 -1
- data/test/tc_node_text.rb +1 -1
- data/test/tc_reader.rb +86 -86
- data/test/tc_sax_parser.rb +120 -35
- data/test/tc_well_formed.rb +1 -2
- metadata +6 -7
- data/ext/libxml/libxml.c.rej +0 -16
- data/ext/libxml/sax_parser_callbacks.inc +0 -235
- data/test/model/saxtest.xml +0 -5
data/ext/libxml/libxml.c.rej
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
***************
|
2
|
-
*** 46,51 ****
|
3
|
-
ruby_init_xml_xinclude();
|
4
|
-
ruby_init_xml_xpath();
|
5
|
-
ruby_init_xml_xpath_context();
|
6
|
-
ruby_init_xml_xpointer();
|
7
|
-
ruby_init_xml_xpointer_context();
|
8
|
-
ruby_init_html_parser();
|
9
|
-
--- 46,52 ----
|
10
|
-
ruby_init_xml_xinclude();
|
11
|
-
ruby_init_xml_xpath();
|
12
|
-
ruby_init_xml_xpath_context();
|
13
|
-
+ ruby_init_xml_xpath_expression();
|
14
|
-
ruby_init_xml_xpointer();
|
15
|
-
ruby_init_xml_xpointer_context();
|
16
|
-
ruby_init_html_parser();
|
@@ -1,235 +0,0 @@
|
|
1
|
-
/* $Id: sax_parser_callbacks.inc 616 2008-11-22 09:25:12Z cfis $ */
|
2
|
-
|
3
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
4
|
-
|
5
|
-
/*
|
6
|
-
* SAX CALLBACK HANDLERS
|
7
|
-
*/
|
8
|
-
static void internal_subset_func(void *ctxt,
|
9
|
-
const char *name,
|
10
|
-
const char *extid,
|
11
|
-
const char *sysid) {
|
12
|
-
VALUE self = (VALUE) ctxt;
|
13
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
14
|
-
|
15
|
-
if (handler != Qnil) {
|
16
|
-
VALUE rname = name ? rb_str_new2(name) : Qnil;
|
17
|
-
VALUE rextid = extid ? rb_str_new2(extid) : Qnil;
|
18
|
-
VALUE rsysid = sysid ? rb_str_new2(sysid) : Qnil;
|
19
|
-
rb_funcall(handler, cbidOnInternalSubset, 3, rname, rextid, rsysid);
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
static void is_standalone_func(void *ctxt) {
|
24
|
-
VALUE self = (VALUE) ctxt;
|
25
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
26
|
-
|
27
|
-
if (handler != Qnil) {
|
28
|
-
rb_funcall(handler, cbidOnIsStandalone,0);
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
static void has_internal_subset_func(void *ctxt) {
|
33
|
-
VALUE self = (VALUE) ctxt;
|
34
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
35
|
-
|
36
|
-
if (handler != Qnil) {
|
37
|
-
rb_funcall(handler, cbidOnHasInternalSubset, 0);
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
static void has_external_subset_func(void *ctxt) {
|
42
|
-
VALUE self = (VALUE) ctxt;
|
43
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
44
|
-
|
45
|
-
if (handler != Qnil) {
|
46
|
-
rb_funcall(handler, cbidOnHasExternalSubset, 0);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
static void start_document_func(void *ctxt) {
|
51
|
-
VALUE self = (VALUE) ctxt;
|
52
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
53
|
-
|
54
|
-
if (handler != Qnil) {
|
55
|
-
rb_funcall(handler, cbidOnStartDocument, 0);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
static void end_document_func(void *ctxt) {
|
60
|
-
VALUE self = (VALUE) ctxt;
|
61
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
62
|
-
|
63
|
-
if (handler != Qnil) {
|
64
|
-
rb_funcall(handler, cbidOnEndDocument, 0);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
static void start_element_func(void *ctxt,
|
69
|
-
const char *name, const char **attrs) {
|
70
|
-
VALUE self = (VALUE) ctxt;
|
71
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
72
|
-
VALUE ahsh = rb_hash_new();
|
73
|
-
const char *attr, *value;
|
74
|
-
|
75
|
-
if (attrs) {
|
76
|
-
while ((attr = *(attrs++))) {
|
77
|
-
value = *(attrs++);
|
78
|
-
rb_hash_aset(ahsh, rb_str_new2(attr), rb_str_new2(value));
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
if (handler != Qnil) {
|
83
|
-
rb_funcall(handler, cbidOnStartElement, 2, rb_str_new2(name), ahsh);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
static void end_element_func(void *ctxt, const char *name) {
|
88
|
-
VALUE self = (VALUE) ctxt;
|
89
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
90
|
-
|
91
|
-
if (handler != Qnil) {
|
92
|
-
rb_funcall(handler, cbidOnEndElement, 1, rb_str_new2(name));
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
static void reference_func(void *ctxt,
|
97
|
-
const char *name) {
|
98
|
-
VALUE self = (VALUE) ctxt;
|
99
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
100
|
-
|
101
|
-
if (handler != Qnil) {
|
102
|
-
rb_funcall(handler, cbidOnReference,1,rb_str_new2(name));
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
static void characters_func(void *ctxt,
|
107
|
-
const char *chars, int len) {
|
108
|
-
VALUE self = (VALUE) ctxt;
|
109
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
110
|
-
|
111
|
-
if (handler != Qnil) {
|
112
|
-
VALUE rchars = rb_str_new(chars, len);
|
113
|
-
rb_funcall(handler, cbidOnCharacters, 1, rchars);
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
static void processing_instruction_func(void *ctxt,
|
118
|
-
const char *target, const char *data) {
|
119
|
-
VALUE self = (VALUE) ctxt;
|
120
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
121
|
-
|
122
|
-
if (handler != Qnil) {
|
123
|
-
VALUE rtarget = target ? rb_str_new2(target) : Qnil;
|
124
|
-
VALUE rdata = data ? rb_str_new2(data) : Qnil;
|
125
|
-
rb_funcall(handler, cbidOnProcessingInstruction, 2, rtarget, rdata);
|
126
|
-
}
|
127
|
-
}
|
128
|
-
|
129
|
-
static void comment_func(void *ctxt,
|
130
|
-
const char *msg) {
|
131
|
-
VALUE self = (VALUE) ctxt;
|
132
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
133
|
-
|
134
|
-
if (handler != Qnil) {
|
135
|
-
rb_funcall(handler, cbidOnComment,1,rb_str_new2(msg));
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
#define FORMAT_AND_CALL(callsym) \
|
140
|
-
do { \
|
141
|
-
va_list args; \
|
142
|
-
char buf[1024]; \
|
143
|
-
va_start(args, msg); \
|
144
|
-
vsnprintf(buf, sizeof buf, msg, args); \
|
145
|
-
rb_funcall(handler,callsym,1,rb_str_new2(buf)); \
|
146
|
-
va_end(args); \
|
147
|
-
} \
|
148
|
-
while (0)
|
149
|
-
|
150
|
-
// TODO these next three should actually be formatting messages.
|
151
|
-
static void warning_func(void *ctxt,
|
152
|
-
const char *msg, ...) {
|
153
|
-
VALUE self = (VALUE) ctxt;
|
154
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
155
|
-
|
156
|
-
if (handler != Qnil) {
|
157
|
-
FORMAT_AND_CALL(cbidOnXmlParserWarning);
|
158
|
-
}
|
159
|
-
}
|
160
|
-
|
161
|
-
static void error_func(void *ctxt,
|
162
|
-
const char *msg, ...) {
|
163
|
-
VALUE self = (VALUE) ctxt;
|
164
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
165
|
-
|
166
|
-
if (handler != Qnil) {
|
167
|
-
FORMAT_AND_CALL(cbidOnXmlParserError);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
|
171
|
-
static void fatal_error_func(void *ctxt,
|
172
|
-
const char *msg, ...) {
|
173
|
-
VALUE self = (VALUE) ctxt;
|
174
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
175
|
-
|
176
|
-
if (handler != Qnil) {
|
177
|
-
FORMAT_AND_CALL(cbidOnXmlParserFatalError);
|
178
|
-
}
|
179
|
-
}
|
180
|
-
|
181
|
-
static void cdata_block_func(void *ctxt,
|
182
|
-
const char *value, int len) {
|
183
|
-
VALUE self = (VALUE) ctxt;
|
184
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
185
|
-
|
186
|
-
if (handler != Qnil) {
|
187
|
-
rb_funcall(handler, cbidOnCdataBlock,1,rb_str_new(value, len));
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
static void external_subset_func(void *ctxt,
|
192
|
-
const char *name,
|
193
|
-
const char *extid,
|
194
|
-
const char *sysid) {
|
195
|
-
VALUE self = (VALUE) ctxt;
|
196
|
-
VALUE handler = rb_ivar_get(self, CALLBACKS_ATTR);
|
197
|
-
|
198
|
-
if (handler != Qnil) {
|
199
|
-
VALUE rname = name ? rb_str_new2(name) : Qnil;
|
200
|
-
VALUE rextid = extid ? rb_str_new2(extid) : Qnil;
|
201
|
-
VALUE rsysid = sysid ? rb_str_new2(sysid) : Qnil;
|
202
|
-
rb_funcall(handler, cbidOnExternalSubset, 3, rname, rextid, rsysid);
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
static xmlSAXHandler rxml_sax_hander_struct = {
|
207
|
-
(internalSubsetSAXFunc)internal_subset_func,
|
208
|
-
(isStandaloneSAXFunc)is_standalone_func,
|
209
|
-
(hasInternalSubsetSAXFunc)has_internal_subset_func,
|
210
|
-
(hasExternalSubsetSAXFunc)has_external_subset_func,
|
211
|
-
0, /* resolveEntity */
|
212
|
-
0, /* getEntity */
|
213
|
-
0, /* entityDecl */
|
214
|
-
0, /* notationDecl */
|
215
|
-
0, /* attributeDecl */
|
216
|
-
0, /* elementDecl */
|
217
|
-
0, /* unparsedEntityDecl */
|
218
|
-
0, /* setDocumentLocator */
|
219
|
-
(startDocumentSAXFunc)start_document_func,
|
220
|
-
(endDocumentSAXFunc)end_document_func,
|
221
|
-
(startElementSAXFunc)start_element_func,
|
222
|
-
(endElementSAXFunc)end_element_func,
|
223
|
-
(referenceSAXFunc)reference_func,
|
224
|
-
(charactersSAXFunc)characters_func,
|
225
|
-
0, /* ignorableWhitespace */
|
226
|
-
(processingInstructionSAXFunc)processing_instruction_func,
|
227
|
-
(commentSAXFunc)comment_func,
|
228
|
-
(warningSAXFunc)warning_func,
|
229
|
-
(errorSAXFunc)error_func,
|
230
|
-
(fatalErrorSAXFunc)fatal_error_func,
|
231
|
-
0, /* xmlGetParameterEntity */
|
232
|
-
(cdataBlockSAXFunc)cdata_block_func,
|
233
|
-
(externalSubsetSAXFunc)external_subset_func,
|
234
|
-
1
|
235
|
-
};
|