nokogiri 1.16.8-x86_64-linux → 1.17.0-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +11 -21
- data/README.md +4 -0
- data/dependencies.yml +6 -6
- data/ext/nokogiri/extconf.rb +191 -137
- data/ext/nokogiri/gumbo.c +69 -53
- data/ext/nokogiri/html4_document.c +10 -4
- data/ext/nokogiri/html4_element_description.c +18 -18
- data/ext/nokogiri/html4_sax_parser.c +40 -0
- data/ext/nokogiri/html4_sax_parser_context.c +48 -58
- data/ext/nokogiri/html4_sax_push_parser.c +25 -24
- data/ext/nokogiri/include/libexslt/exsltconfig.h +3 -3
- data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +12 -19
- data/ext/nokogiri/include/libxml2/libxml/c14n.h +1 -12
- data/ext/nokogiri/include/libxml2/libxml/debugXML.h +1 -1
- data/ext/nokogiri/include/libxml2/libxml/encoding.h +9 -0
- data/ext/nokogiri/include/libxml2/libxml/entities.h +12 -1
- data/ext/nokogiri/include/libxml2/libxml/hash.h +19 -0
- data/ext/nokogiri/include/libxml2/libxml/list.h +2 -2
- data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +17 -0
- data/ext/nokogiri/include/libxml2/libxml/parser.h +60 -54
- data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +9 -1
- data/ext/nokogiri/include/libxml2/libxml/pattern.h +6 -0
- data/ext/nokogiri/include/libxml2/libxml/tree.h +32 -12
- data/ext/nokogiri/include/libxml2/libxml/uri.h +11 -0
- data/ext/nokogiri/include/libxml2/libxml/valid.h +29 -2
- data/ext/nokogiri/include/libxml2/libxml/xinclude.h +7 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +21 -4
- data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +14 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +111 -15
- data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +8 -45
- data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +2 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +5 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +165 -1
- data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +7 -171
- data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +1 -0
- data/ext/nokogiri/include/libxml2/libxml/xpath.h +4 -0
- data/ext/nokogiri/include/libxslt/xsltInternals.h +3 -0
- data/ext/nokogiri/include/libxslt/xsltconfig.h +4 -37
- data/ext/nokogiri/libxml2_polyfill.c +114 -0
- data/ext/nokogiri/nokogiri.c +9 -2
- data/ext/nokogiri/nokogiri.h +18 -33
- data/ext/nokogiri/xml_attr.c +1 -1
- data/ext/nokogiri/xml_cdata.c +2 -10
- data/ext/nokogiri/xml_comment.c +3 -8
- data/ext/nokogiri/xml_document.c +163 -156
- data/ext/nokogiri/xml_document_fragment.c +10 -25
- data/ext/nokogiri/xml_dtd.c +1 -1
- data/ext/nokogiri/xml_element_content.c +9 -9
- data/ext/nokogiri/xml_encoding_handler.c +4 -4
- data/ext/nokogiri/xml_namespace.c +6 -6
- data/ext/nokogiri/xml_node.c +130 -104
- data/ext/nokogiri/xml_node_set.c +46 -44
- data/ext/nokogiri/xml_reader.c +54 -58
- data/ext/nokogiri/xml_relax_ng.c +35 -56
- data/ext/nokogiri/xml_sax_parser.c +156 -88
- data/ext/nokogiri/xml_sax_parser_context.c +213 -131
- data/ext/nokogiri/xml_sax_push_parser.c +68 -49
- data/ext/nokogiri/xml_schema.c +50 -85
- data/ext/nokogiri/xml_syntax_error.c +19 -11
- data/ext/nokogiri/xml_text.c +2 -4
- data/ext/nokogiri/xml_xpath_context.c +2 -2
- data/ext/nokogiri/xslt_stylesheet.c +8 -8
- data/lib/nokogiri/3.0/nokogiri.so +0 -0
- data/lib/nokogiri/3.1/nokogiri.so +0 -0
- data/lib/nokogiri/3.2/nokogiri.so +0 -0
- data/lib/nokogiri/3.3/nokogiri.so +0 -0
- data/lib/nokogiri/class_resolver.rb +1 -1
- data/lib/nokogiri/css/node.rb +6 -2
- data/lib/nokogiri/css/parser.rb +6 -4
- data/lib/nokogiri/css/parser.y +2 -2
- data/lib/nokogiri/css/parser_extras.rb +6 -66
- data/lib/nokogiri/css/selector_cache.rb +38 -0
- data/lib/nokogiri/css/tokenizer.rb +4 -4
- data/lib/nokogiri/css/tokenizer.rex +9 -8
- data/lib/nokogiri/css/xpath_visitor.rb +42 -6
- data/lib/nokogiri/css.rb +86 -20
- data/lib/nokogiri/decorators/slop.rb +3 -5
- data/lib/nokogiri/encoding_handler.rb +2 -2
- data/lib/nokogiri/html4/document.rb +44 -23
- data/lib/nokogiri/html4/document_fragment.rb +124 -12
- data/lib/nokogiri/html4/encoding_reader.rb +1 -1
- data/lib/nokogiri/html4/sax/parser.rb +23 -38
- data/lib/nokogiri/html4/sax/parser_context.rb +4 -9
- data/lib/nokogiri/html4.rb +9 -14
- data/lib/nokogiri/html5/builder.rb +40 -0
- data/lib/nokogiri/html5/document.rb +61 -30
- data/lib/nokogiri/html5/document_fragment.rb +130 -20
- data/lib/nokogiri/html5/node.rb +4 -4
- data/lib/nokogiri/html5.rb +114 -72
- data/lib/nokogiri/version/constant.rb +1 -1
- data/lib/nokogiri/xml/builder.rb +8 -1
- data/lib/nokogiri/xml/document.rb +70 -26
- data/lib/nokogiri/xml/document_fragment.rb +84 -13
- data/lib/nokogiri/xml/node.rb +82 -11
- data/lib/nokogiri/xml/node_set.rb +9 -7
- data/lib/nokogiri/xml/parse_options.rb +1 -1
- data/lib/nokogiri/xml/pp/node.rb +6 -1
- data/lib/nokogiri/xml/reader.rb +46 -13
- data/lib/nokogiri/xml/relax_ng.rb +57 -20
- data/lib/nokogiri/xml/sax/document.rb +174 -83
- data/lib/nokogiri/xml/sax/parser.rb +115 -41
- data/lib/nokogiri/xml/sax/parser_context.rb +116 -8
- data/lib/nokogiri/xml/sax/push_parser.rb +3 -0
- data/lib/nokogiri/xml/sax.rb +48 -0
- data/lib/nokogiri/xml/schema.rb +112 -45
- data/lib/nokogiri/xml/searchable.rb +6 -8
- data/lib/nokogiri/xml/syntax_error.rb +22 -0
- data/lib/nokogiri/xml.rb +13 -24
- data/lib/nokogiri/xslt.rb +3 -9
- data/lib/xsd/xmlparser/nokogiri.rb +3 -4
- metadata +8 -4
- data/ext/nokogiri/libxml2_backwards_compat.c +0 -121
@@ -2,62 +2,92 @@
|
|
2
2
|
|
3
3
|
VALUE cNokogiriXmlSaxParser ;
|
4
4
|
|
5
|
-
static ID id_start_document
|
6
|
-
static ID
|
7
|
-
static ID
|
5
|
+
static ID id_start_document;
|
6
|
+
static ID id_end_document;
|
7
|
+
static ID id_start_element;
|
8
|
+
static ID id_end_element;
|
9
|
+
static ID id_start_element_namespace;
|
10
|
+
static ID id_end_element_namespace;
|
11
|
+
static ID id_comment;
|
12
|
+
static ID id_characters;
|
13
|
+
static ID id_xmldecl;
|
14
|
+
static ID id_error;
|
15
|
+
static ID id_warning;
|
8
16
|
static ID id_cdata_block;
|
9
17
|
static ID id_processing_instruction;
|
18
|
+
static ID id_reference;
|
19
|
+
|
20
|
+
static size_t
|
21
|
+
xml_sax_parser_memsize(const void *data)
|
22
|
+
{
|
23
|
+
return sizeof(xmlSAXHandler);
|
24
|
+
}
|
25
|
+
|
26
|
+
/* Used by Nokogiri::XML::SAX::Parser and Nokogiri::HTML::SAX::Parser */
|
27
|
+
static const rb_data_type_t xml_sax_parser_type = {
|
28
|
+
.wrap_struct_name = "xmlSAXHandler",
|
29
|
+
.function = {
|
30
|
+
.dfree = RUBY_TYPED_DEFAULT_FREE,
|
31
|
+
.dsize = xml_sax_parser_memsize
|
32
|
+
},
|
33
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
|
34
|
+
};
|
10
35
|
|
11
36
|
static void
|
12
|
-
|
37
|
+
noko_xml_sax_parser_start_document_callback(void *ctx)
|
13
38
|
{
|
14
|
-
|
39
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
40
|
+
VALUE self = (VALUE)ctxt->_private;
|
15
41
|
VALUE doc = rb_iv_get(self, "@document");
|
16
42
|
|
17
|
-
|
18
|
-
|
19
|
-
if (
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
rb_funcall(doc, id_xmldecl, 3, version, encoding, standalone);
|
43
|
+
xmlSAX2StartDocument(ctx);
|
44
|
+
|
45
|
+
if (ctxt->standalone != -1) { /* -1 means there was no declaration */
|
46
|
+
VALUE encoding = Qnil ;
|
47
|
+
VALUE standalone = Qnil;
|
48
|
+
VALUE version;
|
49
|
+
|
50
|
+
if (ctxt->encoding) {
|
51
|
+
encoding = NOKOGIRI_STR_NEW2(ctxt->encoding) ;
|
52
|
+
} else if (ctxt->input && ctxt->input->encoding) { // unnecessary after v2.12.0 / gnome/libxml2@ec7be506
|
53
|
+
encoding = NOKOGIRI_STR_NEW2(ctxt->input->encoding) ;
|
54
|
+
}
|
55
|
+
|
56
|
+
version = ctxt->version ? NOKOGIRI_STR_NEW2(ctxt->version) : Qnil;
|
57
|
+
|
58
|
+
/* TODO try using xmlSAX2IsStandalone */
|
59
|
+
switch (ctxt->standalone) {
|
60
|
+
case 0:
|
61
|
+
standalone = NOKOGIRI_STR_NEW2("no");
|
62
|
+
break;
|
63
|
+
case 1:
|
64
|
+
standalone = NOKOGIRI_STR_NEW2("yes");
|
65
|
+
break;
|
42
66
|
}
|
67
|
+
|
68
|
+
rb_funcall(doc, id_xmldecl, 3, version, encoding, standalone);
|
43
69
|
}
|
44
70
|
|
45
71
|
rb_funcall(doc, id_start_document, 0);
|
46
72
|
}
|
47
73
|
|
48
74
|
static void
|
49
|
-
|
75
|
+
noko_xml_sax_parser_end_document_callback(void *ctx)
|
50
76
|
{
|
51
|
-
|
77
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
78
|
+
VALUE self = (VALUE)ctxt->_private;
|
52
79
|
VALUE doc = rb_iv_get(self, "@document");
|
80
|
+
|
53
81
|
rb_funcall(doc, id_end_document, 0);
|
54
82
|
}
|
55
83
|
|
56
84
|
static void
|
57
|
-
|
85
|
+
noko_xml_sax_parser_start_element_callback(void *ctx, const xmlChar *name, const xmlChar **atts)
|
58
86
|
{
|
59
|
-
|
87
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
88
|
+
VALUE self = (VALUE)ctxt->_private;
|
60
89
|
VALUE doc = rb_iv_get(self, "@document");
|
90
|
+
|
61
91
|
VALUE attributes = rb_ary_new();
|
62
92
|
const xmlChar *attr;
|
63
93
|
int i = 0;
|
@@ -79,15 +109,17 @@ start_element(void *ctx, const xmlChar *name, const xmlChar **atts)
|
|
79
109
|
}
|
80
110
|
|
81
111
|
static void
|
82
|
-
|
112
|
+
noko_xml_sax_parser_end_element_callback(void *ctx, const xmlChar *name)
|
83
113
|
{
|
84
|
-
|
114
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
115
|
+
VALUE self = (VALUE)ctxt->_private;
|
85
116
|
VALUE doc = rb_iv_get(self, "@document");
|
117
|
+
|
86
118
|
rb_funcall(doc, id_end_element, 1, NOKOGIRI_STR_NEW2(name));
|
87
119
|
}
|
88
120
|
|
89
121
|
static VALUE
|
90
|
-
|
122
|
+
xml_sax_parser_marshal_attributes(int attributes_len, const xmlChar **c_attributes)
|
91
123
|
{
|
92
124
|
VALUE rb_array = rb_ary_new2((long)attributes_len);
|
93
125
|
VALUE cNokogiriXmlSaxParserAttribute;
|
@@ -116,7 +148,7 @@ attributes_as_array(int attributes_len, const xmlChar **c_attributes)
|
|
116
148
|
}
|
117
149
|
|
118
150
|
static void
|
119
|
-
|
151
|
+
noko_xml_sax_parser_start_element_ns_callback(
|
120
152
|
void *ctx,
|
121
153
|
const xmlChar *localname,
|
122
154
|
const xmlChar *prefix,
|
@@ -127,10 +159,11 @@ start_element_ns(
|
|
127
159
|
int nb_defaulted,
|
128
160
|
const xmlChar **attributes)
|
129
161
|
{
|
130
|
-
|
162
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
163
|
+
VALUE self = (VALUE)ctxt->_private;
|
131
164
|
VALUE doc = rb_iv_get(self, "@document");
|
132
165
|
|
133
|
-
VALUE attribute_ary =
|
166
|
+
VALUE attribute_ary = xml_sax_parser_marshal_attributes(nb_attributes, attributes);
|
134
167
|
|
135
168
|
VALUE ns_list = rb_ary_new2((long)nb_namespaces);
|
136
169
|
|
@@ -161,13 +194,14 @@ start_element_ns(
|
|
161
194
|
* end_element_ns was borrowed heavily from libxml-ruby.
|
162
195
|
*/
|
163
196
|
static void
|
164
|
-
|
197
|
+
noko_xml_sax_parser_end_element_ns_callback(
|
165
198
|
void *ctx,
|
166
199
|
const xmlChar *localname,
|
167
200
|
const xmlChar *prefix,
|
168
201
|
const xmlChar *uri)
|
169
202
|
{
|
170
|
-
|
203
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
204
|
+
VALUE self = (VALUE)ctxt->_private;
|
171
205
|
VALUE doc = rb_iv_get(self, "@document");
|
172
206
|
|
173
207
|
rb_funcall(doc, id_end_element_namespace, 3,
|
@@ -178,29 +212,35 @@ end_element_ns(
|
|
178
212
|
}
|
179
213
|
|
180
214
|
static void
|
181
|
-
|
215
|
+
noko_xml_sax_parser_characters_callback(void *ctx, const xmlChar *ch, int len)
|
182
216
|
{
|
183
|
-
|
217
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
218
|
+
VALUE self = (VALUE)ctxt->_private;
|
184
219
|
VALUE doc = rb_iv_get(self, "@document");
|
220
|
+
|
185
221
|
VALUE str = NOKOGIRI_STR_NEW(ch, len);
|
186
222
|
rb_funcall(doc, id_characters, 1, str);
|
187
223
|
}
|
188
224
|
|
189
225
|
static void
|
190
|
-
|
226
|
+
noko_xml_sax_parser_comment_callback(void *ctx, const xmlChar *value)
|
191
227
|
{
|
192
|
-
|
228
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
229
|
+
VALUE self = (VALUE)ctxt->_private;
|
193
230
|
VALUE doc = rb_iv_get(self, "@document");
|
231
|
+
|
194
232
|
VALUE str = NOKOGIRI_STR_NEW2(value);
|
195
233
|
rb_funcall(doc, id_comment, 1, str);
|
196
234
|
}
|
197
235
|
|
198
236
|
PRINTFLIKE_DECL(2, 3)
|
199
237
|
static void
|
200
|
-
|
238
|
+
noko_xml_sax_parser_warning_callback(void *ctx, const char *msg, ...)
|
201
239
|
{
|
202
|
-
|
240
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
241
|
+
VALUE self = (VALUE)ctxt->_private;
|
203
242
|
VALUE doc = rb_iv_get(self, "@document");
|
243
|
+
|
204
244
|
VALUE rb_message;
|
205
245
|
|
206
246
|
#ifdef TRUFFLERUBY_NOKOGIRI_SYSTEM_LIBRARIES
|
@@ -219,10 +259,12 @@ warning_func(void *ctx, const char *msg, ...)
|
|
219
259
|
|
220
260
|
PRINTFLIKE_DECL(2, 3)
|
221
261
|
static void
|
222
|
-
|
262
|
+
noko_xml_sax_parser_error_callback(void *ctx, const char *msg, ...)
|
223
263
|
{
|
224
|
-
|
264
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
265
|
+
VALUE self = (VALUE)ctxt->_private;
|
225
266
|
VALUE doc = rb_iv_get(self, "@document");
|
267
|
+
|
226
268
|
VALUE rb_message;
|
227
269
|
|
228
270
|
#ifdef TRUFFLERUBY_NOKOGIRI_SYSTEM_LIBRARIES
|
@@ -240,22 +282,24 @@ error_func(void *ctx, const char *msg, ...)
|
|
240
282
|
}
|
241
283
|
|
242
284
|
static void
|
243
|
-
|
285
|
+
noko_xml_sax_parser_cdata_block_callback(void *ctx, const xmlChar *value, int len)
|
244
286
|
{
|
245
|
-
|
287
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
288
|
+
VALUE self = (VALUE)ctxt->_private;
|
246
289
|
VALUE doc = rb_iv_get(self, "@document");
|
290
|
+
|
247
291
|
VALUE string = NOKOGIRI_STR_NEW(value, len);
|
248
292
|
rb_funcall(doc, id_cdata_block, 1, string);
|
249
293
|
}
|
250
294
|
|
251
295
|
static void
|
252
|
-
|
296
|
+
noko_xml_sax_parser_processing_instruction_callback(void *ctx, const xmlChar *name, const xmlChar *content)
|
253
297
|
{
|
254
|
-
|
255
|
-
VALUE self =
|
298
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
299
|
+
VALUE self = (VALUE)ctxt->_private;
|
256
300
|
VALUE doc = rb_iv_get(self, "@document");
|
257
301
|
|
258
|
-
rb_content = content ? NOKOGIRI_STR_NEW2(content) : Qnil;
|
302
|
+
VALUE rb_content = content ? NOKOGIRI_STR_NEW2(content) : Qnil;
|
259
303
|
|
260
304
|
rb_funcall(doc,
|
261
305
|
id_processing_instruction,
|
@@ -265,50 +309,70 @@ processing_instruction(void *ctx, const xmlChar *name, const xmlChar *content)
|
|
265
309
|
);
|
266
310
|
}
|
267
311
|
|
268
|
-
static
|
269
|
-
|
312
|
+
static void
|
313
|
+
noko_xml_sax_parser_reference_callback(void *ctx, const xmlChar *name)
|
270
314
|
{
|
271
|
-
|
272
|
-
|
315
|
+
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
|
316
|
+
xmlEntityPtr entity = xmlSAX2GetEntity(ctxt, name);
|
273
317
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
}
|
318
|
+
VALUE self = (VALUE)ctxt->_private;
|
319
|
+
VALUE doc = rb_iv_get(self, "@document");
|
320
|
+
|
321
|
+
if (entity && entity->content) {
|
322
|
+
rb_funcall(doc, id_reference, 2, NOKOGIRI_STR_NEW2(entity->name), NOKOGIRI_STR_NEW2(entity->content));
|
323
|
+
} else {
|
324
|
+
rb_funcall(doc, id_reference, 2, NOKOGIRI_STR_NEW2(name), Qnil);
|
325
|
+
}
|
326
|
+
}
|
283
327
|
|
284
328
|
static VALUE
|
285
|
-
|
329
|
+
noko_xml_sax_parser__initialize_native(VALUE self)
|
286
330
|
{
|
287
|
-
xmlSAXHandlerPtr handler;
|
288
|
-
|
289
|
-
|
290
|
-
handler->
|
291
|
-
handler->
|
292
|
-
handler->
|
293
|
-
handler->
|
294
|
-
handler->
|
295
|
-
handler->
|
296
|
-
handler->
|
297
|
-
handler->
|
298
|
-
handler->
|
299
|
-
handler->
|
300
|
-
handler->
|
301
|
-
handler->
|
331
|
+
xmlSAXHandlerPtr handler = noko_xml_sax_parser_unwrap(self);
|
332
|
+
|
333
|
+
handler->startDocument = noko_xml_sax_parser_start_document_callback;
|
334
|
+
handler->endDocument = noko_xml_sax_parser_end_document_callback;
|
335
|
+
handler->startElement = noko_xml_sax_parser_start_element_callback;
|
336
|
+
handler->endElement = noko_xml_sax_parser_end_element_callback;
|
337
|
+
handler->startElementNs = noko_xml_sax_parser_start_element_ns_callback;
|
338
|
+
handler->endElementNs = noko_xml_sax_parser_end_element_ns_callback;
|
339
|
+
handler->characters = noko_xml_sax_parser_characters_callback;
|
340
|
+
handler->comment = noko_xml_sax_parser_comment_callback;
|
341
|
+
handler->warning = noko_xml_sax_parser_warning_callback;
|
342
|
+
handler->error = noko_xml_sax_parser_error_callback;
|
343
|
+
handler->cdataBlock = noko_xml_sax_parser_cdata_block_callback;
|
344
|
+
handler->processingInstruction = noko_xml_sax_parser_processing_instruction_callback;
|
345
|
+
handler->reference = noko_xml_sax_parser_reference_callback;
|
346
|
+
|
347
|
+
/* use some of libxml2's default callbacks to managed DTDs and entities */
|
348
|
+
handler->getEntity = xmlSAX2GetEntity;
|
349
|
+
handler->internalSubset = xmlSAX2InternalSubset;
|
350
|
+
handler->externalSubset = xmlSAX2ExternalSubset;
|
351
|
+
handler->isStandalone = xmlSAX2IsStandalone;
|
352
|
+
handler->hasInternalSubset = xmlSAX2HasInternalSubset;
|
353
|
+
handler->hasExternalSubset = xmlSAX2HasExternalSubset;
|
354
|
+
handler->resolveEntity = xmlSAX2ResolveEntity;
|
355
|
+
handler->getParameterEntity = xmlSAX2GetParameterEntity;
|
356
|
+
handler->entityDecl = xmlSAX2EntityDecl;
|
357
|
+
handler->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl;
|
358
|
+
|
302
359
|
handler->initialized = XML_SAX2_MAGIC;
|
303
360
|
|
304
361
|
return self;
|
305
362
|
}
|
306
363
|
|
364
|
+
static VALUE
|
365
|
+
noko_xml_sax_parser_allocate(VALUE klass)
|
366
|
+
{
|
367
|
+
xmlSAXHandlerPtr handler;
|
368
|
+
return TypedData_Make_Struct(klass, xmlSAXHandler, &xml_sax_parser_type, handler);
|
369
|
+
}
|
370
|
+
|
307
371
|
xmlSAXHandlerPtr
|
308
|
-
|
372
|
+
noko_xml_sax_parser_unwrap(VALUE rb_sax_handler)
|
309
373
|
{
|
310
374
|
xmlSAXHandlerPtr c_sax_handler;
|
311
|
-
TypedData_Get_Struct(rb_sax_handler, xmlSAXHandler, &
|
375
|
+
TypedData_Get_Struct(rb_sax_handler, xmlSAXHandler, &xml_sax_parser_type, c_sax_handler);
|
312
376
|
return c_sax_handler;
|
313
377
|
}
|
314
378
|
|
@@ -317,7 +381,10 @@ noko_init_xml_sax_parser(void)
|
|
317
381
|
{
|
318
382
|
cNokogiriXmlSaxParser = rb_define_class_under(mNokogiriXmlSax, "Parser", rb_cObject);
|
319
383
|
|
320
|
-
rb_define_alloc_func(cNokogiriXmlSaxParser,
|
384
|
+
rb_define_alloc_func(cNokogiriXmlSaxParser, noko_xml_sax_parser_allocate);
|
385
|
+
|
386
|
+
rb_define_private_method(cNokogiriXmlSaxParser, "initialize_native",
|
387
|
+
noko_xml_sax_parser__initialize_native, 0);
|
321
388
|
|
322
389
|
id_start_document = rb_intern("start_document");
|
323
390
|
id_end_document = rb_intern("end_document");
|
@@ -332,4 +399,5 @@ noko_init_xml_sax_parser(void)
|
|
332
399
|
id_start_element_namespace = rb_intern("start_element_namespace");
|
333
400
|
id_end_element_namespace = rb_intern("end_element_namespace");
|
334
401
|
id_processing_instruction = rb_intern("processing_instruction");
|
402
|
+
id_reference = rb_intern("reference");
|
335
403
|
}
|