libxml-ruby 0.6.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +122 -0
- data/LICENSE +23 -0
- data/README +144 -0
- data/ext/libxml/cbg.c +76 -0
- data/ext/libxml/extconf.rb +308 -0
- data/ext/libxml/libxml.c +62 -0
- data/ext/libxml/ruby_libxml.h +93 -0
- data/ext/libxml/ruby_xml_attr.c +405 -0
- data/ext/libxml/ruby_xml_attr.h +19 -0
- data/ext/libxml/ruby_xml_document.c +1111 -0
- data/ext/libxml/ruby_xml_document.h +27 -0
- data/ext/libxml/ruby_xml_dtd.c +168 -0
- data/ext/libxml/ruby_xml_dtd.h +17 -0
- data/ext/libxml/ruby_xml_html_parser.c +449 -0
- data/ext/libxml/ruby_xml_html_parser.h +29 -0
- data/ext/libxml/ruby_xml_input_cbg.c +158 -0
- data/ext/libxml/ruby_xml_input_cbg.h +20 -0
- data/ext/libxml/ruby_xml_node.c +2410 -0
- data/ext/libxml/ruby_xml_node.h +27 -0
- data/ext/libxml/ruby_xml_node_set.c +170 -0
- data/ext/libxml/ruby_xml_node_set.h +20 -0
- data/ext/libxml/ruby_xml_ns.c +153 -0
- data/ext/libxml/ruby_xml_ns.h +21 -0
- data/ext/libxml/ruby_xml_parser.c +1425 -0
- data/ext/libxml/ruby_xml_parser.h +31 -0
- data/ext/libxml/ruby_xml_parser_context.c +750 -0
- data/ext/libxml/ruby_xml_parser_context.h +22 -0
- data/ext/libxml/ruby_xml_reader.c +900 -0
- data/ext/libxml/ruby_xml_reader.h +14 -0
- data/ext/libxml/ruby_xml_sax_parser.c +485 -0
- data/ext/libxml/ruby_xml_sax_parser.h +56 -0
- data/ext/libxml/ruby_xml_schema.c +146 -0
- data/ext/libxml/ruby_xml_schema.h +16 -0
- data/ext/libxml/ruby_xml_state.c +113 -0
- data/ext/libxml/ruby_xml_state.h +12 -0
- data/ext/libxml/ruby_xml_tree.c +43 -0
- data/ext/libxml/ruby_xml_tree.h +12 -0
- data/ext/libxml/ruby_xml_xinclude.c +20 -0
- data/ext/libxml/ruby_xml_xinclude.h +13 -0
- data/ext/libxml/ruby_xml_xpath.c +243 -0
- data/ext/libxml/ruby_xml_xpath.h +23 -0
- data/ext/libxml/ruby_xml_xpath_context.c +118 -0
- data/ext/libxml/ruby_xml_xpath_context.h +20 -0
- data/ext/libxml/ruby_xml_xpath_object.c +293 -0
- data/ext/libxml/ruby_xml_xpath_object.h +28 -0
- data/ext/libxml/ruby_xml_xpointer.c +100 -0
- data/ext/libxml/ruby_xml_xpointer.h +27 -0
- data/ext/libxml/ruby_xml_xpointer_context.c +21 -0
- data/ext/libxml/ruby_xml_xpointer_context.h +18 -0
- data/ext/libxml/sax_parser_callbacks.inc +213 -0
- data/ext/libxml/version.h +9 -0
- data/lib/libxml.rb +125 -0
- data/lib/libxml_ruby.so +0 -0
- data/lib/xml/libxml.rb +5 -0
- data/mingw/libiconv-2.dll +0 -0
- data/mingw/libxml2-2.dll +0 -0
- data/mingw/libxml_ruby.so +0 -0
- data/mingw/mingw.rake +36 -0
- data/test/dtd-test.rb +24 -0
- data/test/etc_doc_to_s.rb +19 -0
- data/test/ets_copy_bug.rb +21 -0
- data/test/ets_copy_bug2.rb +32 -0
- data/test/ets_copy_bug3.rb +38 -0
- data/test/ets_doc_file.rb +15 -0
- data/test/ets_doc_to_s.rb +21 -0
- data/test/ets_gpx.rb +26 -0
- data/test/ets_node_gc.rb +21 -0
- data/test/ets_test.xml +2 -0
- data/test/ets_tsr.rb +9 -0
- data/test/gc.log +0 -0
- data/test/merge_bug.rb +55 -0
- data/test/schema-test.rb +74 -0
- data/test/tc_well_formed.rb +11 -0
- data/test/tc_xml_document.rb +52 -0
- data/test/tc_xml_document_write.rb +24 -0
- data/test/tc_xml_document_write2.rb +54 -0
- data/test/tc_xml_document_write3.rb +96 -0
- data/test/tc_xml_html_parser.rb +63 -0
- data/test/tc_xml_node.rb +59 -0
- data/test/tc_xml_node2.rb +25 -0
- data/test/tc_xml_node3.rb +27 -0
- data/test/tc_xml_node4.rb +86 -0
- data/test/tc_xml_node5.rb +52 -0
- data/test/tc_xml_node6.rb +27 -0
- data/test/tc_xml_node7.rb +35 -0
- data/test/tc_xml_node8.rb +32 -0
- data/test/tc_xml_node9.rb +32 -0
- data/test/tc_xml_node_copy.rb +40 -0
- data/test/tc_xml_node_set.rb +24 -0
- data/test/tc_xml_node_set2.rb +37 -0
- data/test/tc_xml_node_text.rb +17 -0
- data/test/tc_xml_node_xlink.rb +28 -0
- data/test/tc_xml_parser.rb +190 -0
- data/test/tc_xml_parser2.rb +16 -0
- data/test/tc_xml_parser3.rb +23 -0
- data/test/tc_xml_parser4.rb +33 -0
- data/test/tc_xml_parser5.rb +27 -0
- data/test/tc_xml_parser6.rb +23 -0
- data/test/tc_xml_parser7.rb +28 -0
- data/test/tc_xml_parser8.rb +32 -0
- data/test/tc_xml_parser9.rb +11 -0
- data/test/tc_xml_parser_context.rb +88 -0
- data/test/tc_xml_reader.rb +112 -0
- data/test/tc_xml_sax_parser.rb +104 -0
- data/test/tc_xml_sax_parser2.rb +51 -0
- data/test/tc_xml_xinclude.rb +30 -0
- data/test/tc_xml_xpath.rb +38 -0
- data/test/tc_xml_xpath2.rb +14 -0
- data/test/tc_xml_xpointer.rb +78 -0
- data/vc/libxml.sln +20 -0
- data/vc/libxml.vcproj +389 -0
- data/work/Rakefile +247 -0
- data/work/task/make +26 -0
- data/work/task/memory +37 -0
- data/work/task/rdoc +39 -0
- data/work/task/setup +1616 -0
- data/work/task/test +29 -0
- data/work/test/ets_runner.rb +33 -0
- data/work/test/libxml_test.rb +3 -0
- data/work/test/runner.rb +0 -0
- data/work/test/runner_ets.rb +33 -0
- data/work/vc/debug/libxml.exp +0 -0
- data/work/vc/debug/libxml.ilk +0 -0
- data/work/vc/debug/libxml.lib +0 -0
- data/work/vc/debug/libxml.pdb +0 -0
- data/work/vc/debug/libxml.so +0 -0
- metadata +224 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
/* Copyright (c) 2006 Apple Computer Inc.
|
2
|
+
* Please see the LICENSE file for copyright and distribution information. */
|
3
|
+
|
4
|
+
#ifndef __RUBY_XML_READER__
|
5
|
+
#define __RUBY_XML_READER__
|
6
|
+
|
7
|
+
extern VALUE cXMLReader;
|
8
|
+
|
9
|
+
void ruby_init_xml_reader(void);
|
10
|
+
|
11
|
+
/* Exported to be used by XML::Document#reader */
|
12
|
+
VALUE ruby_xml_reader_new_walker(VALUE self, VALUE doc);
|
13
|
+
|
14
|
+
#endif /* __RUBY_XML_READER__ */
|
@@ -0,0 +1,485 @@
|
|
1
|
+
/* $Id: ruby_xml_sax_parser.c 300 2008-07-01 19:14:15Z cfis $ */
|
2
|
+
|
3
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
4
|
+
|
5
|
+
#include "ruby_libxml.h"
|
6
|
+
#include "ruby_xml_sax_parser.h"
|
7
|
+
|
8
|
+
VALUE cXMLSaxParser;
|
9
|
+
VALUE mXMLSaxParserCallbacks;
|
10
|
+
|
11
|
+
VALUE cbidOnInternalSubset;
|
12
|
+
VALUE cbidOnIsStandalone;
|
13
|
+
VALUE cbidOnHasInternalSubset;
|
14
|
+
VALUE cbidOnHasExternalSubset;
|
15
|
+
VALUE cbidOnStartDocument;
|
16
|
+
VALUE cbidOnEndDocument;
|
17
|
+
VALUE cbidOnStartElement;
|
18
|
+
VALUE cbidOnEndElement;
|
19
|
+
VALUE cbidOnReference;
|
20
|
+
VALUE cbidOnCharacters;
|
21
|
+
VALUE cbidOnProcessingInstruction;
|
22
|
+
VALUE cbidOnComment;
|
23
|
+
VALUE cbidOnXmlParserWarning;
|
24
|
+
VALUE cbidOnXmlParserError;
|
25
|
+
VALUE cbidOnXmlParserFatalError;
|
26
|
+
VALUE cbidOnCdataBlock;
|
27
|
+
VALUE cbidOnExternalSubset;
|
28
|
+
|
29
|
+
#include "sax_parser_callbacks.inc"
|
30
|
+
|
31
|
+
void
|
32
|
+
ruby_xml_sax_parser_free(ruby_xml_sax_parser *rxsp) {
|
33
|
+
/* Apparently this isn't needed: time will tell */
|
34
|
+
/* if (rxsp->xsh != NULL) */
|
35
|
+
/* xmlFreeSax_Parser(rxsp->sax_parser); */
|
36
|
+
}
|
37
|
+
|
38
|
+
void
|
39
|
+
ruby_xml_sax_parser_mark(ruby_xml_sax_parser *rxsp) {
|
40
|
+
if (rxsp->callbackHandler && (rxsp->callbackHandler != Qnil)) {
|
41
|
+
rb_gc_mark(rxsp->callbackHandler);
|
42
|
+
}
|
43
|
+
|
44
|
+
if (rxsp->filename && (rxsp->filename != Qnil)) {
|
45
|
+
rb_gc_mark(rxsp->filename);
|
46
|
+
}
|
47
|
+
|
48
|
+
if (rxsp->str && (rxsp->str != Qnil)) {
|
49
|
+
rb_gc_mark(rxsp->str);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
/*
|
54
|
+
* call-seq:
|
55
|
+
* XML::SaxParser.new => sax_parser
|
56
|
+
*
|
57
|
+
* Create a new XML::SaxParser instance.
|
58
|
+
*/
|
59
|
+
VALUE
|
60
|
+
ruby_xml_sax_parser_new(VALUE class) {
|
61
|
+
ruby_xml_sax_parser *rxsp;
|
62
|
+
|
63
|
+
rxsp = ALLOC(ruby_xml_sax_parser);
|
64
|
+
rxsp->xsh = &rubySAXHandlerStruct;
|
65
|
+
|
66
|
+
rxsp->callbackHandler = Qnil;
|
67
|
+
rxsp->xpc = NULL;
|
68
|
+
rxsp->filename = Qnil;
|
69
|
+
rxsp->str = Qnil;
|
70
|
+
|
71
|
+
return(Data_Wrap_Struct(class, ruby_xml_sax_parser_mark,
|
72
|
+
ruby_xml_sax_parser_free, rxsp));
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
/*
|
77
|
+
* call-seq:
|
78
|
+
* sax_parser.callbacks => #<XML::SaxParser::Callbacks subclass>
|
79
|
+
*
|
80
|
+
* Obtain the callbacks used by this parser.
|
81
|
+
*/
|
82
|
+
VALUE
|
83
|
+
ruby_xml_sax_parser_callbacks_get(VALUE self) {
|
84
|
+
ruby_xml_sax_parser *rxsp;
|
85
|
+
Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
|
86
|
+
return(rxsp->callbackHandler);
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
/*
|
91
|
+
* call-seq:
|
92
|
+
* sax_parser.callbacks = #<XML::SaxParser::Callbacks subclass>
|
93
|
+
*
|
94
|
+
* Set the callbacks used by this parser. The value assigned to
|
95
|
+
* this attribute will usually be an object that extends the the
|
96
|
+
* XML::SaxParser::Callbacks module, overriding the callbacks it
|
97
|
+
* wishes to process.
|
98
|
+
*/
|
99
|
+
VALUE
|
100
|
+
ruby_xml_sax_parser_callbacks_set(VALUE self, VALUE callbacks) {
|
101
|
+
ruby_xml_sax_parser *rxsp;
|
102
|
+
Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
|
103
|
+
rxsp->callbackHandler = callbacks;
|
104
|
+
return(rxsp->callbackHandler);
|
105
|
+
}
|
106
|
+
|
107
|
+
|
108
|
+
/*
|
109
|
+
* call-seq:
|
110
|
+
* sax_parser.filename => "filename"
|
111
|
+
*
|
112
|
+
* Obtain the filename this parser reads from.
|
113
|
+
*/
|
114
|
+
VALUE
|
115
|
+
ruby_xml_sax_parser_filename_get(VALUE self) {
|
116
|
+
ruby_xml_sax_parser *rxsp;
|
117
|
+
Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
|
118
|
+
return(rxsp->filename);
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
/*
|
123
|
+
* call-seq:
|
124
|
+
* sax_parser.filename = "filename"
|
125
|
+
*
|
126
|
+
* Set the filename this parser reads from.
|
127
|
+
*/
|
128
|
+
VALUE
|
129
|
+
ruby_xml_sax_parser_filename_set(VALUE self, VALUE filename) {
|
130
|
+
ruby_xml_sax_parser *rxsp;
|
131
|
+
Check_Type(filename, T_STRING);
|
132
|
+
Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
|
133
|
+
rxsp->filename = filename;
|
134
|
+
return(rxsp->filename);
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
/*
|
139
|
+
* call-seq:
|
140
|
+
* parser.parse => (true|false)
|
141
|
+
*
|
142
|
+
* Parse the input XML, generating callbacks to the object
|
143
|
+
* registered via the +callbacks+ attribute.
|
144
|
+
*/
|
145
|
+
VALUE
|
146
|
+
ruby_xml_sax_parser_parse(VALUE self) {
|
147
|
+
char *str;
|
148
|
+
int status = 1;
|
149
|
+
ruby_xml_sax_parser *rxsp;
|
150
|
+
|
151
|
+
Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
|
152
|
+
|
153
|
+
if (rxsp->filename != Qnil) {
|
154
|
+
status = xmlSAXUserParseFile(rxsp->xsh, rxsp, StringValuePtr(rxsp->filename));
|
155
|
+
} else if (rxsp->str != Qnil) {
|
156
|
+
str = StringValuePtr(rxsp->str);
|
157
|
+
status = //ruby_xml_document_new(cXMLDocument,
|
158
|
+
xmlSAXUserParseMemory(rxsp->xsh, rxsp,
|
159
|
+
str, strlen(str)); //);
|
160
|
+
}
|
161
|
+
|
162
|
+
/* XXX This should return an exception for the various error codes
|
163
|
+
* that can come back in status, but I'm too lazy to do that right
|
164
|
+
* now. */
|
165
|
+
if (status)
|
166
|
+
return(Qfalse);
|
167
|
+
else
|
168
|
+
return(Qtrue);
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
/*
|
173
|
+
* call-seq:
|
174
|
+
* parser.string => "xml"
|
175
|
+
*
|
176
|
+
* Obtain the parser's input string.
|
177
|
+
*/
|
178
|
+
VALUE
|
179
|
+
ruby_xml_sax_parser_str_get(VALUE self) {
|
180
|
+
ruby_xml_sax_parser *rxsp;
|
181
|
+
Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
|
182
|
+
return(rxsp->str);
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
/*
|
187
|
+
* call-seq:
|
188
|
+
* parser.string = "xml"
|
189
|
+
*
|
190
|
+
* Set the parser's input string.
|
191
|
+
*/
|
192
|
+
VALUE
|
193
|
+
ruby_xml_sax_parser_str_set(VALUE self, VALUE str) {
|
194
|
+
ruby_xml_sax_parser *rxsp;
|
195
|
+
Check_Type(str, T_STRING);
|
196
|
+
Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
|
197
|
+
rxsp->str = str;
|
198
|
+
return(rxsp->str);
|
199
|
+
}
|
200
|
+
|
201
|
+
|
202
|
+
/****** SaxCallbacks ******/
|
203
|
+
/* These are all the same. Bloody Rdoc... */
|
204
|
+
|
205
|
+
/*
|
206
|
+
* call-seq:
|
207
|
+
* callbacks.on_internal_subset(name, external_id, system_id)
|
208
|
+
*
|
209
|
+
* Called for an internal subset event.
|
210
|
+
*/
|
211
|
+
VALUE
|
212
|
+
ruby_xml_sax_callbacks_on_internal_subset(int argc, VALUE *argv, VALUE self) {
|
213
|
+
return Qnil;
|
214
|
+
}
|
215
|
+
|
216
|
+
|
217
|
+
/*
|
218
|
+
* call-seq:
|
219
|
+
* callbacks.on_is_standalone()
|
220
|
+
*
|
221
|
+
* Called for 'is standalone' event.
|
222
|
+
*/
|
223
|
+
VALUE
|
224
|
+
ruby_xml_sax_callbacks_on_is_standalone(int argc, VALUE *argv, VALUE self) {
|
225
|
+
return Qnil;
|
226
|
+
}
|
227
|
+
|
228
|
+
|
229
|
+
/*
|
230
|
+
* call-seq:
|
231
|
+
* callbacks.on_has_internal_subset()
|
232
|
+
*
|
233
|
+
* Called for an internal subset notification event.
|
234
|
+
*/
|
235
|
+
VALUE
|
236
|
+
ruby_xml_sax_callbacks_on_has_internal_subset(int argc, VALUE *argv, VALUE self) {
|
237
|
+
return Qnil;
|
238
|
+
}
|
239
|
+
|
240
|
+
|
241
|
+
/*
|
242
|
+
* call-seq:
|
243
|
+
* callbacks.on_has_external_subset()
|
244
|
+
*
|
245
|
+
* Called for an external subset notification event.
|
246
|
+
*/
|
247
|
+
VALUE
|
248
|
+
ruby_xml_sax_callbacks_on_has_external_subset(int argc, VALUE *argv, VALUE self) {
|
249
|
+
return Qnil;
|
250
|
+
}
|
251
|
+
|
252
|
+
|
253
|
+
/*
|
254
|
+
* call-seq:
|
255
|
+
* callbacks.on_start_document()
|
256
|
+
*
|
257
|
+
* Called for a start document event.
|
258
|
+
*/
|
259
|
+
VALUE
|
260
|
+
ruby_xml_sax_callbacks_on_start_document(int argc, VALUE *argv, VALUE self) {
|
261
|
+
return Qnil;
|
262
|
+
}
|
263
|
+
|
264
|
+
|
265
|
+
/*
|
266
|
+
* call-seq:
|
267
|
+
* callbacks.on_end_document()
|
268
|
+
*
|
269
|
+
* Called for an end document event.
|
270
|
+
*/
|
271
|
+
VALUE
|
272
|
+
ruby_xml_sax_callbacks_on_end_document(int argc, VALUE *argv, VALUE self) {
|
273
|
+
return Qnil;
|
274
|
+
}
|
275
|
+
|
276
|
+
|
277
|
+
/*
|
278
|
+
* call-seq:
|
279
|
+
* callbacks.on_start_element(name, attr_hash)
|
280
|
+
*
|
281
|
+
* Called for an element start event.
|
282
|
+
*/
|
283
|
+
VALUE
|
284
|
+
ruby_xml_sax_callbacks_on_start_element(int argc, VALUE *argv, VALUE self) {
|
285
|
+
return Qnil;
|
286
|
+
}
|
287
|
+
|
288
|
+
|
289
|
+
/*
|
290
|
+
* call-seq:
|
291
|
+
* callbacks.on_end_element(name)
|
292
|
+
*
|
293
|
+
* Called for an element end event.
|
294
|
+
*/
|
295
|
+
VALUE
|
296
|
+
ruby_xml_sax_callbacks_on_end_element(int argc, VALUE *argv, VALUE self) {
|
297
|
+
return Qnil;
|
298
|
+
}
|
299
|
+
|
300
|
+
|
301
|
+
/*
|
302
|
+
* call-seq:
|
303
|
+
* callbacks.on_reference(name)
|
304
|
+
*
|
305
|
+
* Called for a reference event.
|
306
|
+
*/
|
307
|
+
VALUE
|
308
|
+
ruby_xml_sax_callbacks_on_reference(int argc, VALUE *argv, VALUE self) {
|
309
|
+
return Qnil;
|
310
|
+
}
|
311
|
+
|
312
|
+
|
313
|
+
/*
|
314
|
+
* call-seq:
|
315
|
+
* callbacks.on_characters(chars)
|
316
|
+
*
|
317
|
+
* Called for a characters event.
|
318
|
+
*/
|
319
|
+
VALUE
|
320
|
+
ruby_xml_sax_callbacks_on_characters(int argc, VALUE *argv, VALUE self) {
|
321
|
+
return Qnil;
|
322
|
+
}
|
323
|
+
|
324
|
+
|
325
|
+
/*
|
326
|
+
* call-seq:
|
327
|
+
* callbacks.on_processing_instruction(target, data)
|
328
|
+
*
|
329
|
+
* Called for an processing instruction event.
|
330
|
+
*/
|
331
|
+
VALUE
|
332
|
+
ruby_xml_sax_callbacks_on_processing_instruction(int argc, VALUE *argv, VALUE self) {
|
333
|
+
return Qnil;
|
334
|
+
}
|
335
|
+
|
336
|
+
|
337
|
+
/*
|
338
|
+
* call-seq:
|
339
|
+
* callbacks.on_comment(msg)
|
340
|
+
*
|
341
|
+
* Called for a comment event.
|
342
|
+
*/
|
343
|
+
VALUE
|
344
|
+
ruby_xml_sax_callbacks_on_comment(int argc, VALUE *argv, VALUE self) {
|
345
|
+
return Qnil;
|
346
|
+
}
|
347
|
+
|
348
|
+
|
349
|
+
/*
|
350
|
+
* call-seq:
|
351
|
+
* callbacks.on_parser_warning(msg)
|
352
|
+
*
|
353
|
+
* Called for parser warnings.
|
354
|
+
*/
|
355
|
+
VALUE
|
356
|
+
ruby_xml_sax_callbacks_on_parser_warning(int argc, VALUE *argv, VALUE self) {
|
357
|
+
return Qnil;
|
358
|
+
}
|
359
|
+
|
360
|
+
|
361
|
+
/*
|
362
|
+
* call-seq:
|
363
|
+
* callbacks.on_parser_error(msg)
|
364
|
+
*
|
365
|
+
* Called for parser errors.
|
366
|
+
*/
|
367
|
+
VALUE
|
368
|
+
ruby_xml_sax_callbacks_on_parser_error(int argc, VALUE *argv, VALUE self) {
|
369
|
+
return Qnil;
|
370
|
+
}
|
371
|
+
|
372
|
+
|
373
|
+
/*
|
374
|
+
* call-seq:
|
375
|
+
* callbacks.on_parser_fatal_error(msg)
|
376
|
+
*
|
377
|
+
* Called for fatal parser errors.
|
378
|
+
*/
|
379
|
+
VALUE
|
380
|
+
ruby_xml_sax_callbacks_on_parser_fatal_error(int argc, VALUE *argv, VALUE self) {
|
381
|
+
return Qnil;
|
382
|
+
}
|
383
|
+
|
384
|
+
/*
|
385
|
+
* call-seq:
|
386
|
+
* callbacks.on_cdata_block(cdata)
|
387
|
+
*
|
388
|
+
* Called for a CDATA block event.
|
389
|
+
*/
|
390
|
+
VALUE
|
391
|
+
ruby_xml_sax_callbacks_on_cdata_block(int argc, VALUE *argv, VALUE self) {
|
392
|
+
return Qnil;
|
393
|
+
}
|
394
|
+
|
395
|
+
/*
|
396
|
+
* call-seq:
|
397
|
+
* callbacks.on_external_subset(name, external_id, system_id)
|
398
|
+
*
|
399
|
+
* Called for an external subset event.
|
400
|
+
*/
|
401
|
+
VALUE
|
402
|
+
ruby_xml_sax_callbacks_on_external_subset(int argc, VALUE *argv, VALUE self) {
|
403
|
+
return Qnil;
|
404
|
+
}
|
405
|
+
|
406
|
+
|
407
|
+
// Rdoc needs to know
|
408
|
+
#ifdef RDOC_NEVER_DEFINED
|
409
|
+
mXML = rb_define_module("XML");
|
410
|
+
#endif
|
411
|
+
|
412
|
+
void
|
413
|
+
ruby_init_xml_sax_parser(void) {
|
414
|
+
cXMLSaxParser = rb_define_class_under(mXML, "SaxParser", rb_cObject);
|
415
|
+
mXMLSaxParserCallbacks = rb_define_module_under(cXMLSaxParser, "Callbacks");
|
416
|
+
|
417
|
+
/* SaxParser */
|
418
|
+
rb_define_singleton_method(cXMLSaxParser, "new", ruby_xml_sax_parser_new, 0);
|
419
|
+
|
420
|
+
rb_define_method(cXMLSaxParser, "filename",
|
421
|
+
ruby_xml_sax_parser_filename_get, 0);
|
422
|
+
rb_define_method(cXMLSaxParser, "filename=",
|
423
|
+
ruby_xml_sax_parser_filename_set, 1);
|
424
|
+
rb_define_method(cXMLSaxParser, "callbacks",
|
425
|
+
ruby_xml_sax_parser_callbacks_get, 0);
|
426
|
+
rb_define_method(cXMLSaxParser, "callbacks=",
|
427
|
+
ruby_xml_sax_parser_callbacks_set, 1);
|
428
|
+
rb_define_method(cXMLSaxParser, "parse", ruby_xml_sax_parser_parse, 0);
|
429
|
+
rb_define_method(cXMLSaxParser, "string", ruby_xml_sax_parser_str_get, 0);
|
430
|
+
rb_define_method(cXMLSaxParser, "string=", ruby_xml_sax_parser_str_set, 1);
|
431
|
+
|
432
|
+
/* SaxCallbacks */
|
433
|
+
cbidOnInternalSubset = rb_intern("on_internal_subset");
|
434
|
+
cbidOnIsStandalone = rb_intern("on_is_standalone");
|
435
|
+
cbidOnHasInternalSubset = rb_intern("on_has_internal_subset");
|
436
|
+
cbidOnHasExternalSubset = rb_intern("on_has_external_subset");
|
437
|
+
cbidOnStartDocument = rb_intern("on_start_document");
|
438
|
+
cbidOnEndDocument = rb_intern("on_end_document");
|
439
|
+
cbidOnStartElement = rb_intern("on_start_element");
|
440
|
+
cbidOnEndElement = rb_intern("on_end_element");
|
441
|
+
cbidOnReference = rb_intern("on_reference");
|
442
|
+
cbidOnCharacters = rb_intern("on_characters");
|
443
|
+
cbidOnProcessingInstruction = rb_intern("on_processing_instruction");
|
444
|
+
cbidOnComment = rb_intern("on_comment");
|
445
|
+
cbidOnXmlParserWarning = rb_intern("on_parser_warning");
|
446
|
+
cbidOnXmlParserError = rb_intern("on_parser_error");
|
447
|
+
cbidOnXmlParserFatalError = rb_intern("on_parser_fatal_error");
|
448
|
+
cbidOnCdataBlock = rb_intern("on_cdata_block");
|
449
|
+
cbidOnExternalSubset = rb_intern("on_external_subset");
|
450
|
+
|
451
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_internal_subset",
|
452
|
+
ruby_xml_sax_callbacks_on_internal_subset, -1);
|
453
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_is_standalone",
|
454
|
+
ruby_xml_sax_callbacks_on_is_standalone, -1);
|
455
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_has_internal_subset",
|
456
|
+
ruby_xml_sax_callbacks_on_has_internal_subset, -1);
|
457
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_has_external_subset",
|
458
|
+
ruby_xml_sax_callbacks_on_has_external_subset, -1);
|
459
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_start_document",
|
460
|
+
ruby_xml_sax_callbacks_on_start_document, -1);
|
461
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_end_document",
|
462
|
+
ruby_xml_sax_callbacks_on_end_document, -1);
|
463
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_start_element",
|
464
|
+
ruby_xml_sax_callbacks_on_start_element, -1);
|
465
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_end_element",
|
466
|
+
ruby_xml_sax_callbacks_on_end_element, -1);
|
467
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_reference",
|
468
|
+
ruby_xml_sax_callbacks_on_reference, -1);
|
469
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_characters",
|
470
|
+
ruby_xml_sax_callbacks_on_characters, -1);
|
471
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_processing_instruction",
|
472
|
+
ruby_xml_sax_callbacks_on_processing_instruction, -1);
|
473
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_comment",
|
474
|
+
ruby_xml_sax_callbacks_on_comment, -1);
|
475
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_parser_warning",
|
476
|
+
ruby_xml_sax_callbacks_on_parser_warning, -1);
|
477
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_parser_error",
|
478
|
+
ruby_xml_sax_callbacks_on_parser_error, -1);
|
479
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_parser_fatal_error",
|
480
|
+
ruby_xml_sax_callbacks_on_parser_fatal_error, -1);
|
481
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_cdata_block",
|
482
|
+
ruby_xml_sax_callbacks_on_cdata_block, -1);
|
483
|
+
rb_define_method(mXMLSaxParserCallbacks, "on_external_subset",
|
484
|
+
ruby_xml_sax_callbacks_on_external_subset, -1);
|
485
|
+
}
|