libxml-ruby 1.1.2-x86-mswin32-60 → 1.1.3-x86-mswin32-60
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.
- data/CHANGES +20 -0
- data/ext/libxml/build.log +4 -4
- data/ext/libxml/extconf.rb +278 -278
- data/ext/libxml/libxml.c +77 -77
- data/ext/libxml/ruby_xml.c +80 -42
- data/ext/libxml/ruby_xml.h +1 -0
- data/ext/libxml/ruby_xml_attr.c +352 -352
- data/ext/libxml/ruby_xml_attr_decl.c +1 -1
- data/ext/libxml/ruby_xml_attributes.c +3 -3
- data/ext/libxml/ruby_xml_cbg.c +86 -86
- data/ext/libxml/ruby_xml_document.c +936 -915
- data/ext/libxml/ruby_xml_dtd.c +1 -1
- data/ext/libxml/ruby_xml_error.c +5 -4
- data/ext/libxml/ruby_xml_html_parser_context.c +18 -0
- data/ext/libxml/ruby_xml_node.c +131 -177
- data/ext/libxml/ruby_xml_node.h +2 -3
- data/ext/libxml/ruby_xml_parser_context.c +32 -2
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/ext/mingw/libxml_ruby.dll.a +0 -0
- data/ext/mingw/libxml_ruby.so +0 -0
- data/lib/libxml/node.rb +11 -0
- data/test/tc_document.rb +13 -2
- data/test/tc_dtd.rb +5 -4
- data/test/tc_node.rb +1 -1
- data/test/tc_node_edit.rb +28 -4
- data/test/tc_xml.rb +12 -0
- data/test/tc_xpath.rb +0 -10
- metadata +2 -3
- data/test/cro_events.html +0 -740
data/ext/libxml/libxml.c
CHANGED
@@ -1,77 +1,77 @@
|
|
1
|
-
#include "ruby_libxml.h"
|
2
|
-
|
3
|
-
#if RUBY_INTERN_H
|
4
|
-
#include <ruby/util.h>
|
5
|
-
#else
|
6
|
-
#include <util.h>
|
7
|
-
#endif
|
8
|
-
|
9
|
-
VALUE mLibXML;
|
10
|
-
|
11
|
-
static void rxml_init_memory(void)
|
12
|
-
{
|
13
|
-
/* Disable for now - broke attributes.
|
14
|
-
xmlGcMemSetup(
|
15
|
-
(xmlFreeFunc)ruby_xfree,
|
16
|
-
(xmlMallocFunc)ruby_xmalloc,
|
17
|
-
(xmlMallocFunc)ruby_xmalloc,
|
18
|
-
(xmlReallocFunc)ruby_xrealloc,
|
19
|
-
(xmlStrdupFunc)ruby_strdup
|
20
|
-
);*/
|
21
|
-
}
|
22
|
-
|
23
|
-
#if defined(_WIN32)
|
24
|
-
__declspec(dllexport)
|
25
|
-
#endif
|
26
|
-
void Init_libxml_ruby(void)
|
27
|
-
{
|
28
|
-
/* The libxml gem provides Ruby language bindings for GNOME's Libxml2
|
29
|
-
* XML toolkit. To get started you may:
|
30
|
-
*
|
31
|
-
* require 'xml'
|
32
|
-
* document = XML::Document.new
|
33
|
-
*
|
34
|
-
* However, when creating an application or library you plan to
|
35
|
-
* redistribute, it is best to not add the LibXML module to the global
|
36
|
-
* namespace, in which case you can either write your code like this:
|
37
|
-
*
|
38
|
-
* require 'libxml'
|
39
|
-
* document = LibXML::XML::Document.new
|
40
|
-
*
|
41
|
-
* Refer to the README file to get started and the LICENSE file for
|
42
|
-
* copyright and distribution information.
|
43
|
-
*/
|
44
|
-
mLibXML = rb_define_module("LibXML");
|
45
|
-
|
46
|
-
rxml_init_memory();
|
47
|
-
rxml_init_xml();
|
48
|
-
rxml_init_io();
|
49
|
-
rxml_init_error();
|
50
|
-
rxml_init_encoding();
|
51
|
-
rxml_init_parser();
|
52
|
-
rxml_init_parser_context();
|
53
|
-
rxml_init_parser_options();
|
54
|
-
rxml_init_node();
|
55
|
-
rxml_init_attributes();
|
56
|
-
rxml_init_attr();
|
57
|
-
rxml_init_attr_decl();
|
58
|
-
rxml_init_document();
|
59
|
-
rxml_init_namespaces();
|
60
|
-
rxml_init_namespace();
|
61
|
-
rxml_init_sax_parser();
|
62
|
-
rxml_init_sax2_handler();
|
63
|
-
rxml_init_xinclude();
|
64
|
-
rxml_init_xpath();
|
65
|
-
rxml_init_xpath_object();
|
66
|
-
rxml_init_xpath_context();
|
67
|
-
rxml_init_xpath_expression();
|
68
|
-
rxml_init_xpointer();
|
69
|
-
rxml_init_html_parser();
|
70
|
-
rxml_init_html_parser_options();
|
71
|
-
rxml_init_html_parser_context();
|
72
|
-
rxml_init_input_callbacks();
|
73
|
-
rxml_init_dtd();
|
74
|
-
rxml_init_schema();
|
75
|
-
rxml_init_relaxng();
|
76
|
-
rxml_init_reader();
|
77
|
-
}
|
1
|
+
#include "ruby_libxml.h"
|
2
|
+
|
3
|
+
#if RUBY_INTERN_H
|
4
|
+
#include <ruby/util.h>
|
5
|
+
#else
|
6
|
+
#include <util.h>
|
7
|
+
#endif
|
8
|
+
|
9
|
+
VALUE mLibXML;
|
10
|
+
|
11
|
+
static void rxml_init_memory(void)
|
12
|
+
{
|
13
|
+
/* Disable for now - broke attributes.
|
14
|
+
xmlGcMemSetup(
|
15
|
+
(xmlFreeFunc)ruby_xfree,
|
16
|
+
(xmlMallocFunc)ruby_xmalloc,
|
17
|
+
(xmlMallocFunc)ruby_xmalloc,
|
18
|
+
(xmlReallocFunc)ruby_xrealloc,
|
19
|
+
(xmlStrdupFunc)ruby_strdup
|
20
|
+
);*/
|
21
|
+
}
|
22
|
+
|
23
|
+
#if defined(_WIN32)
|
24
|
+
__declspec(dllexport)
|
25
|
+
#endif
|
26
|
+
void Init_libxml_ruby(void)
|
27
|
+
{
|
28
|
+
/* The libxml gem provides Ruby language bindings for GNOME's Libxml2
|
29
|
+
* XML toolkit. To get started you may:
|
30
|
+
*
|
31
|
+
* require 'xml'
|
32
|
+
* document = XML::Document.new
|
33
|
+
*
|
34
|
+
* However, when creating an application or library you plan to
|
35
|
+
* redistribute, it is best to not add the LibXML module to the global
|
36
|
+
* namespace, in which case you can either write your code like this:
|
37
|
+
*
|
38
|
+
* require 'libxml'
|
39
|
+
* document = LibXML::XML::Document.new
|
40
|
+
*
|
41
|
+
* Refer to the README file to get started and the LICENSE file for
|
42
|
+
* copyright and distribution information.
|
43
|
+
*/
|
44
|
+
mLibXML = rb_define_module("LibXML");
|
45
|
+
|
46
|
+
rxml_init_memory();
|
47
|
+
rxml_init_xml();
|
48
|
+
rxml_init_io();
|
49
|
+
rxml_init_error();
|
50
|
+
rxml_init_encoding();
|
51
|
+
rxml_init_parser();
|
52
|
+
rxml_init_parser_context();
|
53
|
+
rxml_init_parser_options();
|
54
|
+
rxml_init_node();
|
55
|
+
rxml_init_attributes();
|
56
|
+
rxml_init_attr();
|
57
|
+
rxml_init_attr_decl();
|
58
|
+
rxml_init_document();
|
59
|
+
rxml_init_namespaces();
|
60
|
+
rxml_init_namespace();
|
61
|
+
rxml_init_sax_parser();
|
62
|
+
rxml_init_sax2_handler();
|
63
|
+
rxml_init_xinclude();
|
64
|
+
rxml_init_xpath();
|
65
|
+
rxml_init_xpath_object();
|
66
|
+
rxml_init_xpath_context();
|
67
|
+
rxml_init_xpath_expression();
|
68
|
+
rxml_init_xpointer();
|
69
|
+
rxml_init_html_parser();
|
70
|
+
rxml_init_html_parser_options();
|
71
|
+
rxml_init_html_parser_context();
|
72
|
+
rxml_init_input_callbacks();
|
73
|
+
rxml_init_dtd();
|
74
|
+
rxml_init_schema();
|
75
|
+
rxml_init_relaxng();
|
76
|
+
rxml_init_reader();
|
77
|
+
}
|
data/ext/libxml/ruby_xml.c
CHANGED
@@ -35,7 +35,7 @@ static VALUE rxml_catalog_remove(VALUE self, VALUE cat)
|
|
35
35
|
* Check LIBXML version matches version the bindings
|
36
36
|
* were compiled to. Throws an exception if not.
|
37
37
|
*/
|
38
|
-
static VALUE rxml_check_lib_versions(VALUE
|
38
|
+
static VALUE rxml_check_lib_versions(VALUE klass)
|
39
39
|
{
|
40
40
|
xmlCheckVersion(LIBXML_VERSION);
|
41
41
|
return (Qtrue);
|
@@ -47,7 +47,7 @@ static VALUE rxml_check_lib_versions(VALUE class)
|
|
47
47
|
*
|
48
48
|
* Determine whether libxml regexp automata support is enabled.
|
49
49
|
*/
|
50
|
-
static VALUE rxml_enabled_automata_q(VALUE
|
50
|
+
static VALUE rxml_enabled_automata_q(VALUE klass)
|
51
51
|
{
|
52
52
|
#ifdef LIBXML_AUTOMATA_ENABLED
|
53
53
|
return(Qtrue);
|
@@ -63,7 +63,7 @@ static VALUE rxml_enabled_automata_q(VALUE class)
|
|
63
63
|
* Determine whether libxml 'canonical XML' support is enabled.
|
64
64
|
* See "Canonical XML" (http://www.w3.org/TR/xml-c14n)
|
65
65
|
*/
|
66
|
-
static VALUE rxml_enabled_c14n_q(VALUE
|
66
|
+
static VALUE rxml_enabled_c14n_q(VALUE klass)
|
67
67
|
{
|
68
68
|
#ifdef LIBXML_C14N_ENABLED
|
69
69
|
return(Qtrue);
|
@@ -78,7 +78,7 @@ static VALUE rxml_enabled_c14n_q(VALUE class)
|
|
78
78
|
*
|
79
79
|
* Determine whether libxml resource catalog support is enabled.
|
80
80
|
*/
|
81
|
-
static VALUE rxml_enabled_catalog_q(VALUE
|
81
|
+
static VALUE rxml_enabled_catalog_q(VALUE klass)
|
82
82
|
{
|
83
83
|
#ifdef LIBXML_CATALOG_ENABLED
|
84
84
|
return(Qtrue);
|
@@ -93,7 +93,7 @@ static VALUE rxml_enabled_catalog_q(VALUE class)
|
|
93
93
|
*
|
94
94
|
* Determine whether libxml debugging support is enabled.
|
95
95
|
*/
|
96
|
-
static VALUE rxml_enabled_debug_q(VALUE
|
96
|
+
static VALUE rxml_enabled_debug_q(VALUE klass)
|
97
97
|
{
|
98
98
|
#ifdef LIBXML_DEBUG_ENABLED
|
99
99
|
return(Qtrue);
|
@@ -108,7 +108,7 @@ static VALUE rxml_enabled_debug_q(VALUE class)
|
|
108
108
|
*
|
109
109
|
* Determine whether libxml docbook support is enabled.
|
110
110
|
*/
|
111
|
-
static VALUE rxml_enabled_docbook_q(VALUE
|
111
|
+
static VALUE rxml_enabled_docbook_q(VALUE klass)
|
112
112
|
{
|
113
113
|
#ifdef LIBXML_DOCB_ENABLED
|
114
114
|
return(Qtrue);
|
@@ -123,7 +123,7 @@ static VALUE rxml_enabled_docbook_q(VALUE class)
|
|
123
123
|
*
|
124
124
|
* Determine whether libxml ftp client support is enabled.
|
125
125
|
*/
|
126
|
-
static VALUE rxml_enabled_ftp_q(VALUE
|
126
|
+
static VALUE rxml_enabled_ftp_q(VALUE klass)
|
127
127
|
{
|
128
128
|
#ifdef LIBXML_FTP_ENABLED
|
129
129
|
return(Qtrue);
|
@@ -138,7 +138,7 @@ static VALUE rxml_enabled_ftp_q(VALUE class)
|
|
138
138
|
*
|
139
139
|
* Determine whether libxml http client support is enabled.
|
140
140
|
*/
|
141
|
-
static VALUE rxml_enabled_http_q(VALUE
|
141
|
+
static VALUE rxml_enabled_http_q(VALUE klass)
|
142
142
|
{
|
143
143
|
#ifdef LIBXML_HTTP_ENABLED
|
144
144
|
return(Qtrue);
|
@@ -153,7 +153,7 @@ static VALUE rxml_enabled_http_q(VALUE class)
|
|
153
153
|
*
|
154
154
|
* Determine whether libxml html support is enabled.
|
155
155
|
*/
|
156
|
-
static VALUE rxml_enabled_html_q(VALUE
|
156
|
+
static VALUE rxml_enabled_html_q(VALUE klass)
|
157
157
|
{
|
158
158
|
#ifdef LIBXML_HTML_ENABLED
|
159
159
|
return(Qtrue);
|
@@ -168,7 +168,7 @@ static VALUE rxml_enabled_html_q(VALUE class)
|
|
168
168
|
*
|
169
169
|
* Determine whether libxml iconv support is enabled.
|
170
170
|
*/
|
171
|
-
static VALUE rxml_enabled_iconv_q(VALUE
|
171
|
+
static VALUE rxml_enabled_iconv_q(VALUE klass)
|
172
172
|
{
|
173
173
|
#ifdef LIBXML_ICONV_ENABLED
|
174
174
|
return(Qtrue);
|
@@ -184,7 +184,7 @@ static VALUE rxml_enabled_iconv_q(VALUE class)
|
|
184
184
|
* Determine whether libxml memory location debugging support
|
185
185
|
* is enabled.
|
186
186
|
*/
|
187
|
-
static VALUE rxml_enabled_memory_debug_location_q(VALUE
|
187
|
+
static VALUE rxml_enabled_memory_debug_location_q(VALUE klass)
|
188
188
|
{
|
189
189
|
#ifdef DEBUG_MEMORY_LOCATION
|
190
190
|
return(Qtrue);
|
@@ -199,7 +199,7 @@ static VALUE rxml_enabled_memory_debug_location_q(VALUE class)
|
|
199
199
|
*
|
200
200
|
* Determine whether libxml regular expression support is enabled.
|
201
201
|
*/
|
202
|
-
static VALUE rxml_enabled_regexp_q(VALUE
|
202
|
+
static VALUE rxml_enabled_regexp_q(VALUE klass)
|
203
203
|
{
|
204
204
|
#ifdef LIBXML_REGEXP_ENABLED
|
205
205
|
return(Qtrue);
|
@@ -214,7 +214,7 @@ static VALUE rxml_enabled_regexp_q(VALUE class)
|
|
214
214
|
*
|
215
215
|
* Determine whether libxml schema support is enabled.
|
216
216
|
*/
|
217
|
-
static VALUE rxml_enabled_schemas_q(VALUE
|
217
|
+
static VALUE rxml_enabled_schemas_q(VALUE klass)
|
218
218
|
{
|
219
219
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
220
220
|
return(Qtrue);
|
@@ -231,7 +231,7 @@ static VALUE rxml_enabled_schemas_q(VALUE class)
|
|
231
231
|
* is used by this ruby extension. Threading support in libxml uses pthread
|
232
232
|
* on Unix-like systems and Win32 threads on Windows.
|
233
233
|
*/
|
234
|
-
static VALUE rxml_enabled_thread_q(VALUE
|
234
|
+
static VALUE rxml_enabled_thread_q(VALUE klass)
|
235
235
|
{
|
236
236
|
/* This won't be defined unless this code is compiled with _REENTRANT or __MT__
|
237
237
|
* defined or the compiler is in C99 mode.
|
@@ -257,7 +257,7 @@ static VALUE rxml_enabled_thread_q(VALUE class)
|
|
257
257
|
*
|
258
258
|
* Determine whether libxml unicode support is enabled.
|
259
259
|
*/
|
260
|
-
static VALUE rxml_enabled_unicode_q(VALUE
|
260
|
+
static VALUE rxml_enabled_unicode_q(VALUE klass)
|
261
261
|
{
|
262
262
|
#ifdef LIBXML_UNICODE_ENABLED
|
263
263
|
return(Qtrue);
|
@@ -272,7 +272,7 @@ static VALUE rxml_enabled_unicode_q(VALUE class)
|
|
272
272
|
*
|
273
273
|
* Determine whether libxml xinclude support is enabled.
|
274
274
|
*/
|
275
|
-
static VALUE rxml_enabled_xinclude_q(VALUE
|
275
|
+
static VALUE rxml_enabled_xinclude_q(VALUE klass)
|
276
276
|
{
|
277
277
|
#ifdef LIBXML_XINCLUDE_ENABLED
|
278
278
|
return(Qtrue);
|
@@ -287,7 +287,7 @@ static VALUE rxml_enabled_xinclude_q(VALUE class)
|
|
287
287
|
*
|
288
288
|
* Determine whether libxml xpath support is enabled.
|
289
289
|
*/
|
290
|
-
static VALUE rxml_enabled_xpath_q(VALUE
|
290
|
+
static VALUE rxml_enabled_xpath_q(VALUE klass)
|
291
291
|
{
|
292
292
|
#ifdef LIBXML_XPATH_ENABLED
|
293
293
|
return(Qtrue);
|
@@ -302,7 +302,7 @@ static VALUE rxml_enabled_xpath_q(VALUE class)
|
|
302
302
|
*
|
303
303
|
* Determine whether libxml xpointer support is enabled.
|
304
304
|
*/
|
305
|
-
static VALUE rxml_enabled_xpointer_q(VALUE
|
305
|
+
static VALUE rxml_enabled_xpointer_q(VALUE klass)
|
306
306
|
{
|
307
307
|
#ifdef LIBXML_XPTR_ENABLED
|
308
308
|
return(Qtrue);
|
@@ -317,7 +317,7 @@ static VALUE rxml_enabled_xpointer_q(VALUE class)
|
|
317
317
|
*
|
318
318
|
* Determine whether libxml zlib support is enabled.
|
319
319
|
*/
|
320
|
-
static VALUE rxml_enabled_zlib_q(VALUE
|
320
|
+
static VALUE rxml_enabled_zlib_q(VALUE klass)
|
321
321
|
{
|
322
322
|
#ifdef HAVE_ZLIB_H
|
323
323
|
return(Qtrue);
|
@@ -333,7 +333,7 @@ static VALUE rxml_enabled_zlib_q(VALUE class)
|
|
333
333
|
* Determine whether included-entity debugging is enabled.
|
334
334
|
* (Requires Libxml to be compiled with debugging support)
|
335
335
|
*/
|
336
|
-
static VALUE rxml_debug_entities_get(VALUE
|
336
|
+
static VALUE rxml_debug_entities_get(VALUE klass)
|
337
337
|
{
|
338
338
|
#ifdef LIBXML_DEBUG_ENABLED
|
339
339
|
if (xmlParserDebugEntities)
|
@@ -353,7 +353,7 @@ static VALUE rxml_debug_entities_get(VALUE class)
|
|
353
353
|
* Enable or disable included-entity debugging.
|
354
354
|
* (Requires Libxml to be compiled with debugging support)
|
355
355
|
*/
|
356
|
-
static VALUE rxml_debug_entities_set(VALUE
|
356
|
+
static VALUE rxml_debug_entities_set(VALUE klass, VALUE bool)
|
357
357
|
{
|
358
358
|
#ifdef LIBXML_DEBUG_ENABLED
|
359
359
|
if (TYPE(bool) == T_FALSE)
|
@@ -377,7 +377,7 @@ static VALUE rxml_debug_entities_set(VALUE class, VALUE bool)
|
|
377
377
|
*
|
378
378
|
* Determine whether parsers retain whitespace by default.
|
379
379
|
*/
|
380
|
-
static VALUE rxml_default_keep_blanks_get(VALUE
|
380
|
+
static VALUE rxml_default_keep_blanks_get(VALUE klass)
|
381
381
|
{
|
382
382
|
if (xmlKeepBlanksDefaultValue)
|
383
383
|
return (Qtrue);
|
@@ -391,7 +391,7 @@ static VALUE rxml_default_keep_blanks_get(VALUE class)
|
|
391
391
|
*
|
392
392
|
* Controls whether parsers retain whitespace by default.
|
393
393
|
*/
|
394
|
-
static VALUE rxml_default_keep_blanks_set(VALUE
|
394
|
+
static VALUE rxml_default_keep_blanks_set(VALUE klass, VALUE bool)
|
395
395
|
{
|
396
396
|
if (TYPE(bool) == T_FALSE)
|
397
397
|
{
|
@@ -415,7 +415,7 @@ static VALUE rxml_default_keep_blanks_set(VALUE class, VALUE bool)
|
|
415
415
|
*
|
416
416
|
* Determine whether parsers load external DTDs by default.
|
417
417
|
*/
|
418
|
-
static VALUE rxml_default_load_external_dtd_get(VALUE
|
418
|
+
static VALUE rxml_default_load_external_dtd_get(VALUE klass)
|
419
419
|
{
|
420
420
|
if (xmlLoadExtDtdDefaultValue)
|
421
421
|
return (Qtrue);
|
@@ -429,7 +429,7 @@ static VALUE rxml_default_load_external_dtd_get(VALUE class)
|
|
429
429
|
*
|
430
430
|
* Controls whether parsers load external DTDs by default.
|
431
431
|
*/
|
432
|
-
static VALUE rxml_default_load_external_dtd_set(VALUE
|
432
|
+
static VALUE rxml_default_load_external_dtd_set(VALUE klass, VALUE bool)
|
433
433
|
{
|
434
434
|
if (bool == Qfalse)
|
435
435
|
{
|
@@ -449,7 +449,7 @@ static VALUE rxml_default_load_external_dtd_set(VALUE class, VALUE bool)
|
|
449
449
|
*
|
450
450
|
* Determine whether parsers retain line-numbers by default.
|
451
451
|
*/
|
452
|
-
static VALUE rxml_default_line_numbers_get(VALUE
|
452
|
+
static VALUE rxml_default_line_numbers_get(VALUE klass)
|
453
453
|
{
|
454
454
|
if (xmlLineNumbersDefaultValue)
|
455
455
|
return (Qtrue);
|
@@ -463,7 +463,7 @@ static VALUE rxml_default_line_numbers_get(VALUE class)
|
|
463
463
|
*
|
464
464
|
* Controls whether parsers retain line-numbers by default.
|
465
465
|
*/
|
466
|
-
static VALUE rxml_default_line_numbers_set(VALUE
|
466
|
+
static VALUE rxml_default_line_numbers_set(VALUE klass, VALUE bool)
|
467
467
|
{
|
468
468
|
if (TYPE(bool) == T_FALSE)
|
469
469
|
{
|
@@ -477,13 +477,50 @@ static VALUE rxml_default_line_numbers_set(VALUE class, VALUE bool)
|
|
477
477
|
}
|
478
478
|
}
|
479
479
|
|
480
|
+
int rxml_libxml_default_options()
|
481
|
+
{
|
482
|
+
int options = 0;
|
483
|
+
|
484
|
+
if (xmlLoadExtDtdDefaultValue)
|
485
|
+
options |= XML_PARSE_DTDLOAD;
|
486
|
+
|
487
|
+
if (xmlDoValidityCheckingDefaultValue)
|
488
|
+
options |= XML_PARSE_DTDVALID;
|
489
|
+
|
490
|
+
if (!xmlKeepBlanksDefaultValue)
|
491
|
+
options |= XML_PARSE_NOBLANKS;
|
492
|
+
|
493
|
+
if (xmlSubstituteEntitiesDefaultValue)
|
494
|
+
options |= XML_PARSE_NOENT;
|
495
|
+
|
496
|
+
if (!xmlGetWarningsDefaultValue)
|
497
|
+
options |= XML_PARSE_NOWARNING;
|
498
|
+
|
499
|
+
if (xmlPedanticParserDefaultValue)
|
500
|
+
options |= XML_PARSE_PEDANTIC;
|
501
|
+
|
502
|
+
return options;
|
503
|
+
}
|
504
|
+
|
505
|
+
/*
|
506
|
+
* call-seq:
|
507
|
+
* XML.default_options -> int
|
508
|
+
*
|
509
|
+
* Returns an integer that summarize libxml2's default options.
|
510
|
+
*/
|
511
|
+
static VALUE rxml_default_options_get(VALUE klass)
|
512
|
+
{
|
513
|
+
int options = rxml_libxml_default_options();
|
514
|
+
return INT2NUM(options);
|
515
|
+
}
|
516
|
+
|
480
517
|
/*
|
481
518
|
* call-seq:
|
482
519
|
* XML.default_pedantic_parser -> (true|false)
|
483
520
|
*
|
484
521
|
* Determine whether parsers are pedantic by default.
|
485
522
|
*/
|
486
|
-
static VALUE rxml_default_pedantic_parser_get(VALUE
|
523
|
+
static VALUE rxml_default_pedantic_parser_get(VALUE klass)
|
487
524
|
{
|
488
525
|
if (xmlPedanticParserDefaultValue)
|
489
526
|
return (Qtrue);
|
@@ -497,7 +534,7 @@ static VALUE rxml_default_pedantic_parser_get(VALUE class)
|
|
497
534
|
*
|
498
535
|
* Controls whether parsers are pedantic by default.
|
499
536
|
*/
|
500
|
-
static VALUE rxml_default_pedantic_parser_set(VALUE
|
537
|
+
static VALUE rxml_default_pedantic_parser_set(VALUE klass, VALUE bool)
|
501
538
|
{
|
502
539
|
if (TYPE(bool) == T_FALSE)
|
503
540
|
{
|
@@ -518,7 +555,7 @@ static VALUE rxml_default_pedantic_parser_set(VALUE class, VALUE bool)
|
|
518
555
|
* Determine whether parsers perform inline entity substitution
|
519
556
|
* (for external entities) by default.
|
520
557
|
*/
|
521
|
-
static VALUE rxml_default_substitute_entities_get(VALUE
|
558
|
+
static VALUE rxml_default_substitute_entities_get(VALUE klass)
|
522
559
|
{
|
523
560
|
if (xmlSubstituteEntitiesDefaultValue)
|
524
561
|
return (Qtrue);
|
@@ -533,7 +570,7 @@ static VALUE rxml_default_substitute_entities_get(VALUE class)
|
|
533
570
|
* Controls whether parsers perform inline entity substitution
|
534
571
|
* (for external entities) by default.
|
535
572
|
*/
|
536
|
-
static VALUE rxml_default_substitute_entities_set(VALUE
|
573
|
+
static VALUE rxml_default_substitute_entities_set(VALUE klass, VALUE bool)
|
537
574
|
{
|
538
575
|
if (bool == Qfalse)
|
539
576
|
{
|
@@ -554,7 +591,7 @@ static VALUE rxml_default_substitute_entities_set(VALUE class, VALUE bool)
|
|
554
591
|
* Obtain the default string used by parsers to indent the XML tree
|
555
592
|
* for output.
|
556
593
|
*/
|
557
|
-
static VALUE rxml_default_tree_indent_string_get(VALUE
|
594
|
+
static VALUE rxml_default_tree_indent_string_get(VALUE klass)
|
558
595
|
{
|
559
596
|
if (xmlTreeIndentString == NULL)
|
560
597
|
return (Qnil);
|
@@ -569,7 +606,7 @@ static VALUE rxml_default_tree_indent_string_get(VALUE class)
|
|
569
606
|
* Set the default string used by parsers to indent the XML tree
|
570
607
|
* for output.
|
571
608
|
*/
|
572
|
-
static VALUE rxml_default_tree_indent_string_set(VALUE
|
609
|
+
static VALUE rxml_default_tree_indent_string_set(VALUE klass, VALUE string)
|
573
610
|
{
|
574
611
|
Check_Type(string, T_STRING);
|
575
612
|
xmlTreeIndentString = xmlStrdup((xmlChar *)StringValuePtr(string));
|
@@ -582,7 +619,7 @@ static VALUE rxml_default_tree_indent_string_set(VALUE class, VALUE string)
|
|
582
619
|
*
|
583
620
|
* Determine whether parsers perform XML validation by default.
|
584
621
|
*/
|
585
|
-
static VALUE rxml_default_validity_checking_get(VALUE
|
622
|
+
static VALUE rxml_default_validity_checking_get(VALUE klass)
|
586
623
|
{
|
587
624
|
if (xmlDoValidityCheckingDefaultValue)
|
588
625
|
return (Qtrue);
|
@@ -596,7 +633,7 @@ static VALUE rxml_default_validity_checking_get(VALUE class)
|
|
596
633
|
*
|
597
634
|
* Controls whether parsers perform XML validation by default.
|
598
635
|
*/
|
599
|
-
static VALUE rxml_default_validity_checking_set(VALUE
|
636
|
+
static VALUE rxml_default_validity_checking_set(VALUE klass, VALUE bool)
|
600
637
|
{
|
601
638
|
if (TYPE(bool) == T_FALSE)
|
602
639
|
{
|
@@ -616,7 +653,7 @@ static VALUE rxml_default_validity_checking_set(VALUE class, VALUE bool)
|
|
616
653
|
*
|
617
654
|
* Determine whether parsers output warnings by default.
|
618
655
|
*/
|
619
|
-
static VALUE rxml_default_warnings_get(VALUE
|
656
|
+
static VALUE rxml_default_warnings_get(VALUE klass)
|
620
657
|
{
|
621
658
|
if (xmlGetWarningsDefaultValue)
|
622
659
|
return (Qtrue);
|
@@ -630,7 +667,7 @@ static VALUE rxml_default_warnings_get(VALUE class)
|
|
630
667
|
*
|
631
668
|
* Controls whether parsers output warnings by default.
|
632
669
|
*/
|
633
|
-
static VALUE rxml_default_warnings_set(VALUE
|
670
|
+
static VALUE rxml_default_warnings_set(VALUE klass, VALUE bool)
|
634
671
|
{
|
635
672
|
if (TYPE(bool) == T_FALSE)
|
636
673
|
{
|
@@ -651,7 +688,7 @@ static VALUE rxml_default_warnings_set(VALUE class, VALUE bool)
|
|
651
688
|
* Determine whether parsers use Zlib compression by default
|
652
689
|
* (requires libxml to be compiled with Zlib support).
|
653
690
|
*/
|
654
|
-
static VALUE rxml_default_compression_get(VALUE
|
691
|
+
static VALUE rxml_default_compression_get(VALUE klass)
|
655
692
|
{
|
656
693
|
#ifdef HAVE_ZLIB_H
|
657
694
|
return(INT2FIX(xmlGetCompressMode()));
|
@@ -668,7 +705,7 @@ static VALUE rxml_default_compression_get(VALUE class)
|
|
668
705
|
* Controls whether parsers use Zlib compression by default
|
669
706
|
* (requires libxml to be compiled with Zlib support).
|
670
707
|
*/
|
671
|
-
static VALUE rxml_default_compression_set(VALUE
|
708
|
+
static VALUE rxml_default_compression_set(VALUE klass, VALUE num)
|
672
709
|
{
|
673
710
|
#ifdef HAVE_ZLIB_H
|
674
711
|
Check_Type(num, T_FIXNUM);
|
@@ -687,7 +724,7 @@ static VALUE rxml_default_compression_set(VALUE class, VALUE num)
|
|
687
724
|
* Obtains an array of strings representing features supported
|
688
725
|
* (and enabled) by the installed libxml.
|
689
726
|
*/
|
690
|
-
static VALUE rxml_features(VALUE
|
727
|
+
static VALUE rxml_features(VALUE klass)
|
691
728
|
{
|
692
729
|
VALUE arr, str;
|
693
730
|
int i, len = MAX_LIBXML_FEATURES_LEN;
|
@@ -722,7 +759,7 @@ static VALUE rxml_features(VALUE class)
|
|
722
759
|
* Determines whether XML output will be indented
|
723
760
|
* (using the string supplied to +default_indent_tree_string+)
|
724
761
|
*/
|
725
|
-
static VALUE rxml_indent_tree_output_get(VALUE
|
762
|
+
static VALUE rxml_indent_tree_output_get(VALUE klass)
|
726
763
|
{
|
727
764
|
if (xmlIndentTreeOutput)
|
728
765
|
return (Qtrue);
|
@@ -737,7 +774,7 @@ static VALUE rxml_indent_tree_output_get(VALUE class)
|
|
737
774
|
* Controls whether XML output will be indented
|
738
775
|
* (using the string supplied to +default_indent_tree_string+)
|
739
776
|
*/
|
740
|
-
static VALUE rxml_indent_tree_output_set(VALUE
|
777
|
+
static VALUE rxml_indent_tree_output_set(VALUE klass, VALUE bool)
|
741
778
|
{
|
742
779
|
if (TYPE(bool) == T_TRUE)
|
743
780
|
{
|
@@ -837,6 +874,7 @@ void rxml_init_xml(void)
|
|
837
874
|
rb_define_module_function(mXML, "default_load_external_dtd=", rxml_default_load_external_dtd_set, 1);
|
838
875
|
rb_define_module_function(mXML, "default_line_numbers", rxml_default_line_numbers_get, 0);
|
839
876
|
rb_define_module_function(mXML, "default_line_numbers=", rxml_default_line_numbers_set, 1);
|
877
|
+
rb_define_module_function(mXML, "default_options", rxml_default_options_get, 0);
|
840
878
|
rb_define_module_function(mXML, "default_pedantic_parser", rxml_default_pedantic_parser_get, 0);
|
841
879
|
rb_define_module_function(mXML, "default_pedantic_parser=", rxml_default_pedantic_parser_set, 1);
|
842
880
|
rb_define_module_function(mXML, "default_substitute_entities", rxml_default_substitute_entities_get, 0);
|