libxml-ruby 0.9.5-x86-mswin32-60 → 0.9.6-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.
Files changed (79) hide show
  1. data/CHANGES +28 -0
  2. data/README +8 -12
  3. data/ext/libxml/cbg.c +86 -86
  4. data/ext/libxml/libxml.c +875 -899
  5. data/ext/libxml/ruby_libxml.h +91 -65
  6. data/ext/libxml/ruby_xml_attr.c +485 -485
  7. data/ext/libxml/ruby_xml_attr.h +3 -3
  8. data/ext/libxml/ruby_xml_attributes.h +2 -2
  9. data/ext/libxml/ruby_xml_document.c +124 -307
  10. data/ext/libxml/ruby_xml_document.h +3 -3
  11. data/ext/libxml/ruby_xml_dtd.c +119 -119
  12. data/ext/libxml/ruby_xml_dtd.h +2 -2
  13. data/ext/libxml/ruby_xml_error.c +1 -1
  14. data/ext/libxml/ruby_xml_error.h +2 -2
  15. data/ext/libxml/ruby_xml_html_parser.c +119 -119
  16. data/ext/libxml/ruby_xml_html_parser.h +3 -3
  17. data/ext/libxml/ruby_xml_input.c +13 -11
  18. data/ext/libxml/ruby_xml_input.h +3 -3
  19. data/ext/libxml/ruby_xml_input_cbg.c +197 -197
  20. data/ext/libxml/ruby_xml_namespace.c +158 -0
  21. data/ext/libxml/ruby_xml_namespace.h +12 -0
  22. data/ext/libxml/ruby_xml_namespaces.c +303 -0
  23. data/ext/libxml/{ruby_xml_ns.h → ruby_xml_namespaces.h} +4 -5
  24. data/ext/libxml/ruby_xml_node.c +88 -293
  25. data/ext/libxml/ruby_xml_node.h +4 -4
  26. data/ext/libxml/ruby_xml_parser.c +152 -152
  27. data/ext/libxml/ruby_xml_parser.h +3 -3
  28. data/ext/libxml/ruby_xml_parser_context.c +630 -657
  29. data/ext/libxml/ruby_xml_parser_context.h +3 -3
  30. data/ext/libxml/ruby_xml_reader.c +899 -904
  31. data/ext/libxml/ruby_xml_reader.h +2 -2
  32. data/ext/libxml/ruby_xml_relaxng.h +2 -2
  33. data/ext/libxml/ruby_xml_sax_parser.c +175 -175
  34. data/ext/libxml/ruby_xml_sax_parser.h +3 -3
  35. data/ext/libxml/ruby_xml_schema.c +165 -165
  36. data/ext/libxml/ruby_xml_schema.h +2 -2
  37. data/ext/libxml/ruby_xml_state.h +2 -2
  38. data/ext/libxml/ruby_xml_xinclude.c +24 -24
  39. data/ext/libxml/ruby_xml_xinclude.h +3 -3
  40. data/ext/libxml/ruby_xml_xpath.c +108 -108
  41. data/ext/libxml/ruby_xml_xpath.h +3 -3
  42. data/ext/libxml/ruby_xml_xpath_context.c +84 -35
  43. data/ext/libxml/ruby_xml_xpath_context.h +3 -3
  44. data/ext/libxml/ruby_xml_xpath_expression.c +5 -7
  45. data/ext/libxml/ruby_xml_xpath_expression.h +2 -2
  46. data/ext/libxml/ruby_xml_xpath_object.c +7 -7
  47. data/ext/libxml/ruby_xml_xpath_object.h +2 -2
  48. data/ext/libxml/ruby_xml_xpointer.c +107 -107
  49. data/ext/libxml/ruby_xml_xpointer.h +3 -3
  50. data/ext/libxml/version.h +2 -2
  51. data/ext/mingw/libxml_ruby.dll.a +0 -0
  52. data/ext/mingw/libxml_ruby.so +0 -0
  53. data/ext/vc/libxml_ruby.vcproj +13 -5
  54. data/lib/libxml.rb +4 -1
  55. data/lib/libxml/document.rb +40 -6
  56. data/lib/libxml/hpricot.rb +76 -76
  57. data/lib/libxml/namespace.rb +60 -0
  58. data/lib/libxml/namespaces.rb +36 -0
  59. data/lib/libxml/node.rb +90 -26
  60. data/lib/libxml/ns.rb +20 -0
  61. data/test/model/bands.xml +5 -0
  62. data/test/tc_attributes.rb +1 -1
  63. data/test/tc_document.rb +24 -41
  64. data/test/tc_document_write.rb +87 -115
  65. data/test/tc_namespace.rb +59 -0
  66. data/test/tc_namespaces.rb +174 -0
  67. data/test/tc_node.rb +41 -33
  68. data/test/tc_node_copy.rb +1 -1
  69. data/test/tc_node_edit.rb +6 -0
  70. data/test/tc_node_write.rb +76 -0
  71. data/test/tc_xinclude.rb +2 -9
  72. data/test/tc_xpath.rb +38 -11
  73. data/test/test_suite.rb +3 -1
  74. metadata +16 -9
  75. data/ext/libxml/ruby_xml_ns.c +0 -150
  76. data/test/ets_copy_bug.rb +0 -21
  77. data/test/ets_copy_bug3.rb +0 -38
  78. data/test/model/default_validation_bug.rb +0 -0
  79. data/test/tc_ns.rb +0 -18
data/CHANGES CHANGED
@@ -1,5 +1,33 @@
1
1
  (See log/ChangeLog for more detailed changes derived directly from source control.)
2
2
 
3
+ == 0.9.6 / 2008-12-08 Charlie Savage
4
+
5
+ * Refactored namespace handling. The existing, and inconsistent,
6
+ namespace methods defined on XML::Node have been deprecated.
7
+ They have been replaced by a the new XML::Namespaces class.
8
+ Use this class to inspect a node's namespace, its default
9
+ namespace, its namespace definitions and which namespaces
10
+ are in scope. It can be accessed via the the
11
+ XML::Node#namespaces method.
12
+
13
+ * Rationalized XML::Document#save, XML::Document#to_s and
14
+ XML::Node#to_s to take an optional hash table of parameters
15
+ that control how output is generated. Supported parameters
16
+ include setting indentation on or off, the indentation level
17
+ and the output encoding. This is an API change and may break
18
+ existing calls to XML::Document#save. However, the previous
19
+ API was broken - setting the encoding resulted in an error so
20
+ its unlikely anyone is using it.
21
+
22
+ * Rationalized XML::Document#debug, XML::Node#debug, XML::XPath::XPathObject#Debug.
23
+
24
+ * Deprecated a number of duplicate dump* and debug_* methods in
25
+ XML::Document and XML::Node.
26
+
27
+ * Additional Ruby 1.9.1 compatability fixes.
28
+
29
+ * Cleaned up header file guards.
30
+
3
31
  == 0.9.5 / 2008-11-29 Charlie Savage
4
32
 
5
33
  * Ruby 1.9.1 preview release compatability (Felipe Contreras)
data/README CHANGED
@@ -43,27 +43,23 @@ solution. If you wish to run a debug version of libxml-ruby on
43
43
  Windows, then it is highly recommended you use VC++.
44
44
 
45
45
  == Getting Started
46
- Using libxml is easy. First decide what parser you want to use:
47
-
48
- * Generally you'll want to use the XML::Parser which provides
49
- a tree based API
50
- * For large documents that won't fit into memory, or if you
51
- prefer an input based API, then use XML::Reader
52
- * If you are parsing HTML files, then use XML::HTMLParser
53
- * If you are masochistic or old stream, then use the XML::SaxParser
54
- which provides a callback API.
46
+ Using libxml is easy. First decide what parser you want to use.
47
+ Generally you'll want to use the LibXML::XML::Parser which provides a tree based API.
48
+ For larger documents that don't fit into memory, or if you prefer an input based API,
49
+ then use LibXML::XML::Reader. If you are parsing HTML files, then use LibXML::XML::HTMLParser.
50
+ Finally, if you are masochistic, then use the LibXML::XML::SaxParser, which provides a callback API.
55
51
 
56
52
  Once you choose a parser, then choose a datasource and its
57
53
  encoding. Libxml can parse files, strings, URIs and IO stream.
58
- For more information, see XML::Input.
54
+ For more information, see LibXML::XML::Input.
59
55
 
60
56
  == Advanced Functionality
61
57
  Beyond the basics of parsing and processing XML and HTML documents,
62
58
  lLibxml provides a wealth of additional functionality.
63
59
 
64
- Most commonly, you'll want to use its XML::XPath support, which makes
60
+ Most commonly, you'll want to use its LibXML::XML::XPath support, which makes
65
61
  it easy to search for data inside and XML document. Although not as
66
- popular, XML::XPointer provides another API for finding data inside
62
+ popular, LibXML::XML::XPointer provides another API for finding data inside
67
63
  an XML document.
68
64
 
69
65
  Often times you'll need to validate data before processing it. For example,
data/ext/libxml/cbg.c CHANGED
@@ -1,86 +1,86 @@
1
- #include <string.h>
2
- #include <libxml/xmlIO.h>
3
- #include "ruby.h"
4
-
5
- /*
6
- int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
7
- xmlInputOpenCallback openFunc,
8
- xmlInputReadCallback readFunc,
9
- xmlInputCloseCallback closeFunc);
10
-
11
-
12
- int (*xmlInputMatchCallback) (char const *filename);
13
- void* (*xmlInputOpenCallback) (char const *filename);
14
- int (*xmlInputReadCallback) (void *context,
15
- char *buffer,
16
- int len);
17
- int (*xmlInputCloseCallback) (void *context);
18
- */
19
-
20
- typedef struct deb_doc_context
21
- {
22
- char *buffer;
23
- char *bpos;
24
- int remaining;
25
- } deb_doc_context;
26
-
27
- int deb_Match(char const *filename)
28
- {
29
- fprintf(stderr, "deb_Match: %s\n", filename);
30
- if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "deb://", 6))
31
- {
32
- return (1);
33
- }
34
- return (0);
35
- }
36
-
37
- void* deb_Open(char const *filename)
38
- {
39
- deb_doc_context *deb_doc;
40
- VALUE res;
41
-
42
- deb_doc = (deb_doc_context*) malloc(sizeof(deb_doc_context));
43
-
44
- res = rb_funcall(rb_funcall(rb_mKernel, rb_intern("const_get"), 1,
45
- rb_str_new2("DEBSystem")), rb_intern("document_query"), 1, rb_str_new2(
46
- filename));
47
- deb_doc->buffer = strdup(StringValuePtr(res));
48
- //deb_doc->buffer = strdup("<serepes>serepes</serepes>");
49
-
50
- deb_doc->bpos = deb_doc->buffer;
51
- deb_doc->remaining = strlen(deb_doc->buffer);
52
- return deb_doc;
53
- }
54
-
55
- int deb_Read(void *context, char *buffer, int len)
56
- {
57
- deb_doc_context *deb_doc;
58
- int ret_len;
59
- deb_doc = (deb_doc_context*) context;
60
-
61
- if (len >= deb_doc->remaining)
62
- {
63
- ret_len = deb_doc->remaining;
64
- }
65
- else
66
- {
67
- ret_len = len;
68
- }
69
- deb_doc->remaining -= ret_len;
70
- strncpy(buffer, deb_doc->bpos, ret_len);
71
- deb_doc->bpos += ret_len;
72
-
73
- return ret_len;
74
- }
75
-
76
- int deb_Close(void *context)
77
- {
78
- free(((deb_doc_context*) context)->buffer);
79
- free(context);
80
- return 1;
81
- }
82
-
83
- void deb_register_cbg()
84
- {
85
- xmlRegisterInputCallbacks(deb_Match, deb_Open, deb_Read, deb_Close);
86
- }
1
+ #include <string.h>
2
+ #include <libxml/xmlIO.h>
3
+ #include "ruby.h"
4
+
5
+ /*
6
+ int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
7
+ xmlInputOpenCallback openFunc,
8
+ xmlInputReadCallback readFunc,
9
+ xmlInputCloseCallback closeFunc);
10
+
11
+
12
+ int (*xmlInputMatchCallback) (char const *filename);
13
+ void* (*xmlInputOpenCallback) (char const *filename);
14
+ int (*xmlInputReadCallback) (void *context,
15
+ char *buffer,
16
+ int len);
17
+ int (*xmlInputCloseCallback) (void *context);
18
+ */
19
+
20
+ typedef struct deb_doc_context
21
+ {
22
+ char *buffer;
23
+ char *bpos;
24
+ int remaining;
25
+ } deb_doc_context;
26
+
27
+ int deb_Match(char const *filename)
28
+ {
29
+ fprintf(stderr, "deb_Match: %s\n", filename);
30
+ if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "deb://", 6))
31
+ {
32
+ return (1);
33
+ }
34
+ return (0);
35
+ }
36
+
37
+ void* deb_Open(char const *filename)
38
+ {
39
+ deb_doc_context *deb_doc;
40
+ VALUE res;
41
+
42
+ deb_doc = (deb_doc_context*) malloc(sizeof(deb_doc_context));
43
+
44
+ res = rb_funcall(rb_funcall(rb_mKernel, rb_intern("const_get"), 1,
45
+ rb_str_new2("DEBSystem")), rb_intern("document_query"), 1, rb_str_new2(
46
+ filename));
47
+ deb_doc->buffer = strdup(StringValuePtr(res));
48
+ //deb_doc->buffer = strdup("<serepes>serepes</serepes>");
49
+
50
+ deb_doc->bpos = deb_doc->buffer;
51
+ deb_doc->remaining = strlen(deb_doc->buffer);
52
+ return deb_doc;
53
+ }
54
+
55
+ int deb_Read(void *context, char *buffer, int len)
56
+ {
57
+ deb_doc_context *deb_doc;
58
+ int ret_len;
59
+ deb_doc = (deb_doc_context*) context;
60
+
61
+ if (len >= deb_doc->remaining)
62
+ {
63
+ ret_len = deb_doc->remaining;
64
+ }
65
+ else
66
+ {
67
+ ret_len = len;
68
+ }
69
+ deb_doc->remaining -= ret_len;
70
+ strncpy(buffer, deb_doc->bpos, ret_len);
71
+ deb_doc->bpos += ret_len;
72
+
73
+ return ret_len;
74
+ }
75
+
76
+ int deb_Close(void *context)
77
+ {
78
+ free(((deb_doc_context*) context)->buffer);
79
+ free(context);
80
+ return 1;
81
+ }
82
+
83
+ void deb_register_cbg()
84
+ {
85
+ xmlRegisterInputCallbacks(deb_Match, deb_Open, deb_Read, deb_Close);
86
+ }
data/ext/libxml/libxml.c CHANGED
@@ -1,899 +1,875 @@
1
- /* $Id: libxml.c 650 2008-11-30 03:40:22Z cfis $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #include "ruby_libxml.h"
6
-
7
- VALUE mLibXML;
8
- VALUE mXML;
9
-
10
- /*
11
- * call-seq:
12
- * XML.catalog_dump -> true
13
- *
14
- * Dump all the global catalog content stdout.
15
- */
16
- static VALUE rxml_catalog_dump(VALUE self)
17
- {
18
- xmlCatalogDump(stdout);
19
- return (Qtrue);
20
- }
21
-
22
- /*
23
- * call-seq:
24
- * XML.catalog_remove(catalog) -> true
25
- *
26
- * Remove the specified resource catalog.
27
- */
28
- static VALUE rxml_catalog_remove(VALUE self, VALUE cat)
29
- {
30
- Check_Type(cat, T_STRING);
31
- xmlCatalogRemove((xmlChar *) StringValuePtr(cat));
32
- return (Qtrue);
33
- }
34
-
35
- /*
36
- * call-seq:
37
- * XML.check_lib_versions -> true
38
- *
39
- * Check LIBXML version matches version the bindings
40
- * were compiled to. Throws an exception if not.
41
- */
42
- static VALUE rxml_check_lib_versions(VALUE class)
43
- {
44
- xmlCheckVersion(LIBXML_VERSION);
45
- return (Qtrue);
46
- }
47
-
48
- /*
49
- * call-seq:
50
- * XML.enabled_automata? -> (true|false)
51
- *
52
- * Determine whether libxml regexp automata support is enabled.
53
- */
54
- static VALUE rxml_enabled_automata_q(VALUE class)
55
- {
56
- #ifdef LIBXML_AUTOMATA_ENABLED
57
- return(Qtrue);
58
- #else
59
- return (Qfalse);
60
- #endif
61
- }
62
-
63
- /*
64
- * call-seq:
65
- * XML.enabled_c14n? -> (true|false)
66
- *
67
- * Determine whether libxml 'canonical XML' support is enabled.
68
- * See "Canonical XML" (http://www.w3.org/TR/xml-c14n)
69
- */
70
- static VALUE rxml_enabled_c14n_q(VALUE class)
71
- {
72
- #ifdef LIBXML_C14N_ENABLED
73
- return(Qtrue);
74
- #else
75
- return (Qfalse);
76
- #endif
77
- }
78
-
79
- /*
80
- * call-seq:
81
- * XML.enabled_catalog? -> (true|false)
82
- *
83
- * Determine whether libxml resource catalog support is enabled.
84
- */
85
- static VALUE rxml_enabled_catalog_q(VALUE class)
86
- {
87
- #ifdef LIBXML_CATALOG_ENABLED
88
- return(Qtrue);
89
- #else
90
- return (Qfalse);
91
- #endif
92
- }
93
-
94
- /*
95
- * call-seq:
96
- * XML.enabled_debug? -> (true|false)
97
- *
98
- * Determine whether libxml debugging support is enabled.
99
- */
100
- static VALUE rxml_enabled_debug_q(VALUE class)
101
- {
102
- #ifdef LIBXML_DEBUG_ENABLED
103
- return(Qtrue);
104
- #else
105
- return (Qfalse);
106
- #endif
107
- }
108
-
109
- /*
110
- * call-seq:
111
- * XML.enabled_docbook? -> (true|false)
112
- *
113
- * Determine whether libxml docbook support is enabled.
114
- */
115
- static VALUE rxml_enabled_docbook_q(VALUE class)
116
- {
117
- #ifdef LIBXML_DOCB_ENABLED
118
- return(Qtrue);
119
- #else
120
- return (Qfalse);
121
- #endif
122
- }
123
-
124
- /*
125
- * call-seq:
126
- * XML.enabled_ftp? -> (true|false)
127
- *
128
- * Determine whether libxml ftp client support is enabled.
129
- */
130
- static VALUE rxml_enabled_ftp_q(VALUE class)
131
- {
132
- #ifdef LIBXML_FTP_ENABLED
133
- return(Qtrue);
134
- #else
135
- return (Qfalse);
136
- #endif
137
- }
138
-
139
- /*
140
- * call-seq:
141
- * XML.enabled_http? -> (true|false)
142
- *
143
- * Determine whether libxml http client support is enabled.
144
- */
145
- static VALUE rxml_enabled_http_q(VALUE class)
146
- {
147
- #ifdef LIBXML_HTTP_ENABLED
148
- return(Qtrue);
149
- #else
150
- return (Qfalse);
151
- #endif
152
- }
153
-
154
- /*
155
- * call-seq:
156
- * XML.enabled_html? -> (true|false)
157
- *
158
- * Determine whether libxml html support is enabled.
159
- */
160
- static VALUE rxml_enabled_html_q(VALUE class)
161
- {
162
- #ifdef LIBXML_HTML_ENABLED
163
- return(Qtrue);
164
- #else
165
- return (Qfalse);
166
- #endif
167
- }
168
-
169
- /*
170
- * call-seq:
171
- * XML.enabled_iconv? -> (true|false)
172
- *
173
- * Determine whether libxml iconv support is enabled.
174
- */
175
- static VALUE rxml_enabled_iconv_q(VALUE class)
176
- {
177
- #ifdef LIBXML_ICONV_ENABLED
178
- return(Qtrue);
179
- #else
180
- return (Qfalse);
181
- #endif
182
- }
183
-
184
- /*
185
- * call-seq:
186
- * XML.enabled_memory_debug? -> (true|false)
187
- *
188
- * Determine whether libxml memory location debugging support
189
- * is enabled.
190
- */
191
- static VALUE rxml_enabled_memory_debug_location_q(VALUE class)
192
- {
193
- #ifdef DEBUG_MEMORY_LOCATION
194
- return(Qtrue);
195
- #else
196
- return (Qfalse);
197
- #endif
198
- }
199
-
200
- /*
201
- * call-seq:
202
- * XML.enabled_regexp? -> (true|false)
203
- *
204
- * Determine whether libxml regular expression support is enabled.
205
- */
206
- static VALUE rxml_enabled_regexp_q(VALUE class)
207
- {
208
- #ifdef LIBXML_REGEXP_ENABLED
209
- return(Qtrue);
210
- #else
211
- return (Qfalse);
212
- #endif
213
- }
214
-
215
- /*
216
- * call-seq:
217
- * XML.enabled_schemas? -> (true|false)
218
- *
219
- * Determine whether libxml schema support is enabled.
220
- */
221
- static VALUE rxml_enabled_schemas_q(VALUE class)
222
- {
223
- #ifdef LIBXML_SCHEMAS_ENABLED
224
- return(Qtrue);
225
- #else
226
- return (Qfalse);
227
- #endif
228
- }
229
-
230
- /*
231
- * call-seq:
232
- * XML.enabled_thread? -> (true|false)
233
- *
234
- * Determine whether libxml thread-safe semantics support
235
- * is enabled (I think?).
236
- */
237
- static VALUE rxml_enabled_thread_q(VALUE class)
238
- {
239
- #ifdef LIBXML_THREAD_ENABLED
240
- return(Qtrue);
241
- #else
242
- return (Qfalse);
243
- #endif
244
- }
245
-
246
- /*
247
- * call-seq:
248
- * XML.enabled_unicode? -> (true|false)
249
- *
250
- * Determine whether libxml unicode support is enabled.
251
- */
252
- static VALUE rxml_enabled_unicode_q(VALUE class)
253
- {
254
- #ifdef LIBXML_UNICODE_ENABLED
255
- return(Qtrue);
256
- #else
257
- return (Qfalse);
258
- #endif
259
- }
260
-
261
- /*
262
- * call-seq:
263
- * XML.enabled_xinclude? -> (true|false)
264
- *
265
- * Determine whether libxml xinclude support is enabled.
266
- */
267
- static VALUE rxml_enabled_xinclude_q(VALUE class)
268
- {
269
- #ifdef LIBXML_XINCLUDE_ENABLED
270
- return(Qtrue);
271
- #else
272
- return (Qfalse);
273
- #endif
274
- }
275
-
276
- /*
277
- * call-seq:
278
- * XML.enabled_xpath? -> (true|false)
279
- *
280
- * Determine whether libxml xpath support is enabled.
281
- */
282
- static VALUE rxml_enabled_xpath_q(VALUE class)
283
- {
284
- #ifdef LIBXML_XPATH_ENABLED
285
- return(Qtrue);
286
- #else
287
- return (Qfalse);
288
- #endif
289
- }
290
-
291
- /*
292
- * call-seq:
293
- * XML.enabled_xpointer? -> (true|false)
294
- *
295
- * Determine whether libxml xpointer support is enabled.
296
- */
297
- static VALUE rxml_enabled_xpointer_q(VALUE class)
298
- {
299
- #ifdef LIBXML_XPTR_ENABLED
300
- return(Qtrue);
301
- #else
302
- return (Qfalse);
303
- #endif
304
- }
305
-
306
- /*
307
- * call-seq:
308
- * XML.enabled_zlib? -> (true|false)
309
- *
310
- * Determine whether libxml zlib support is enabled.
311
- */
312
- static VALUE rxml_enabled_zlib_q(VALUE class)
313
- {
314
- #ifdef HAVE_ZLIB_H
315
- return(Qtrue);
316
- #else
317
- return (Qfalse);
318
- #endif
319
- }
320
-
321
- /*
322
- * call-seq:
323
- * XML.debug_entities -> (true|false)
324
- *
325
- * Determine whether included-entity debugging is enabled.
326
- * (Requires Libxml to be compiled with debugging support)
327
- */
328
- static VALUE rxml_debug_entities_get(VALUE class)
329
- {
330
- #ifdef LIBXML_DEBUG_ENABLED
331
- if (xmlParserDebugEntities)
332
- return(Qtrue);
333
- else
334
- return(Qfalse);
335
- #else
336
- rb_warn("libxml was compiled with debugging turned off");
337
- return (Qfalse);
338
- #endif
339
- }
340
-
341
- /*
342
- * call-seq:
343
- * XML.debug_entities = true|false
344
- *
345
- * Enable or disable included-entity debugging.
346
- * (Requires Libxml to be compiled with debugging support)
347
- */
348
- static VALUE rxml_debug_entities_set(VALUE class, VALUE bool)
349
- {
350
- #ifdef LIBXML_DEBUG_ENABLED
351
- if (TYPE(bool) == T_FALSE)
352
- {
353
- xmlParserDebugEntities = 0;
354
- return(Qfalse);
355
- }
356
- else
357
- {
358
- xmlParserDebugEntities = 1;
359
- return(Qtrue);
360
- }
361
- #else
362
- rb_warn("libxml was compiled with debugging turned off");
363
- #endif
364
- }
365
-
366
- /*
367
- * call-seq:
368
- * XML.default_keep_blanks -> (true|false)
369
- *
370
- * Determine whether parsers retain whitespace by default.
371
- */
372
- static VALUE rxml_default_keep_blanks_get(VALUE class)
373
- {
374
- if (xmlKeepBlanksDefaultValue)
375
- return (Qtrue);
376
- else
377
- return (Qfalse);
378
- }
379
-
380
- /*
381
- * call-seq:
382
- * XML.default_keep_blanks = true|false
383
- *
384
- * Controls whether parsers retain whitespace by default.
385
- */
386
- static VALUE rxml_default_keep_blanks_set(VALUE class, VALUE bool)
387
- {
388
- if (TYPE(bool) == T_FALSE)
389
- {
390
- xmlKeepBlanksDefaultValue = 0;
391
- return (Qfalse);
392
- }
393
- else if (TYPE(bool) == T_TRUE)
394
- {
395
- xmlKeepBlanksDefaultValue = 1;
396
- return (Qtrue);
397
- }
398
- else
399
- {
400
- rb_raise(rb_eArgError, "Invalid argument, must be a boolean");
401
- }
402
- }
403
-
404
- /*
405
- * call-seq:
406
- * XML.default_load_external_dtd -> (true|false)
407
- *
408
- * Determine whether parsers load external DTDs by default.
409
- */
410
- static VALUE rxml_default_load_external_dtd_get(VALUE class)
411
- {
412
- if (xmlLoadExtDtdDefaultValue)
413
- return (Qtrue);
414
- else
415
- return (Qfalse);
416
- }
417
-
418
- /*
419
- * call-seq:
420
- * XML.default_load_external_dtd = true|false
421
- *
422
- * Controls whether parsers load external DTDs by default.
423
- */
424
- static VALUE rxml_default_load_external_dtd_set(VALUE class, VALUE bool)
425
- {
426
- if (TYPE(bool) == T_FALSE)
427
- {
428
- xmlLoadExtDtdDefaultValue = 0;
429
- return (Qfalse);
430
- }
431
- else
432
- {
433
- xmlLoadExtDtdDefaultValue = 1;
434
- return (Qtrue);
435
- }
436
- }
437
-
438
- /*
439
- * call-seq:
440
- * XML.default_line_numbers -> (true|false)
441
- *
442
- * Determine whether parsers retain line-numbers by default.
443
- */
444
- static VALUE rxml_default_line_numbers_get(VALUE class)
445
- {
446
- if (xmlLineNumbersDefaultValue)
447
- return (Qtrue);
448
- else
449
- return (Qfalse);
450
- }
451
-
452
- /*
453
- * call-seq:
454
- * XML.default_line_numbers = true|false
455
- *
456
- * Controls whether parsers retain line-numbers by default.
457
- */
458
- static VALUE rxml_default_line_numbers_set(VALUE class, VALUE bool)
459
- {
460
- if (TYPE(bool) == T_FALSE)
461
- {
462
- xmlLineNumbersDefault(0);
463
- return (Qfalse);
464
- }
465
- else
466
- {
467
- xmlLineNumbersDefault(1);
468
- return (Qtrue);
469
- }
470
- }
471
-
472
- /*
473
- * call-seq:
474
- * XML.default_pedantic_parser -> (true|false)
475
- *
476
- * Determine whether parsers are pedantic by default.
477
- */
478
- static VALUE rxml_default_pedantic_parser_get(VALUE class)
479
- {
480
- if (xmlPedanticParserDefaultValue)
481
- return (Qtrue);
482
- else
483
- return (Qfalse);
484
- }
485
-
486
- /*
487
- * call-seq:
488
- * XML.default_pedantic_parser = true|false
489
- *
490
- * Controls whether parsers are pedantic by default.
491
- */
492
- static VALUE rxml_default_pedantic_parser_set(VALUE class, VALUE bool)
493
- {
494
- if (TYPE(bool) == T_FALSE)
495
- {
496
- xmlPedanticParserDefault(0);
497
- return (Qfalse);
498
- }
499
- else
500
- {
501
- xmlPedanticParserDefault(1);
502
- return (Qtrue);
503
- }
504
- }
505
-
506
- /*
507
- * call-seq:
508
- * XML.default_substitute_entities -> (true|false)
509
- *
510
- * Determine whether parsers perform inline entity substitution
511
- * (for external entities) by default.
512
- */
513
- static VALUE rxml_default_substitute_entities_get(VALUE class)
514
- {
515
- if (xmlSubstituteEntitiesDefaultValue)
516
- return (Qtrue);
517
- else
518
- return (Qfalse);
519
- }
520
-
521
- /*
522
- * call-seq:
523
- * XML.default_substitute_entities = true|false
524
- *
525
- * Controls whether parsers perform inline entity substitution
526
- * (for external entities) by default.
527
- */
528
- static VALUE rxml_default_substitute_entities_set(VALUE class, VALUE bool)
529
- {
530
- if (TYPE(bool) == T_FALSE)
531
- {
532
- xmlSubstituteEntitiesDefault(0);
533
- return (Qfalse);
534
- }
535
- else
536
- {
537
- xmlSubstituteEntitiesDefault(1);
538
- return (Qtrue);
539
- }
540
- }
541
-
542
- /*
543
- * call-seq:
544
- * XML.default_tree_indent_string -> "string"
545
- *
546
- * Obtain the default string used by parsers to indent the XML tree
547
- * for output.
548
- */
549
- static VALUE rxml_default_tree_indent_string_get(VALUE class)
550
- {
551
- if (xmlTreeIndentString == NULL)
552
- return (Qnil);
553
- else
554
- return (rb_str_new2(xmlTreeIndentString));
555
- }
556
-
557
- /*
558
- * call-seq:
559
- * XML.default_tree_indent_string = "string"
560
- *
561
- * Set the default string used by parsers to indent the XML tree
562
- * for output.
563
- */
564
- static VALUE rxml_default_tree_indent_string_set(VALUE class, VALUE string)
565
- {
566
- Check_Type(string, T_STRING);
567
- xmlTreeIndentString = xmlStrdup(StringValuePtr(string));
568
- return (string);
569
- }
570
-
571
- /*
572
- * call-seq:
573
- * XML.default_validity_checking -> (true|false)
574
- *
575
- * Determine whether parsers perform XML validation by default.
576
- */
577
- static VALUE rxml_default_validity_checking_get(VALUE class)
578
- {
579
- if (xmlDoValidityCheckingDefaultValue)
580
- return (Qtrue);
581
- else
582
- return (Qfalse);
583
- }
584
-
585
- /*
586
- * call-seq:
587
- * XML.default_validity_checking = true|false
588
- *
589
- * Controls whether parsers perform XML validation by default.
590
- */
591
- static VALUE rxml_default_validity_checking_set(VALUE class, VALUE bool)
592
- {
593
- if (TYPE(bool) == T_FALSE)
594
- {
595
- xmlDoValidityCheckingDefaultValue = 0;
596
- return (Qfalse);
597
- }
598
- else
599
- {
600
- xmlDoValidityCheckingDefaultValue = 1;
601
- return (Qtrue);
602
- }
603
- }
604
-
605
- /*
606
- * call-seq:
607
- * XML.default_warnings -> (true|false)
608
- *
609
- * Determine whether parsers output warnings by default.
610
- */
611
- static VALUE rxml_default_warnings_get(VALUE class)
612
- {
613
- if (xmlGetWarningsDefaultValue)
614
- return (Qtrue);
615
- else
616
- return (Qfalse);
617
- }
618
-
619
- /*
620
- * call-seq:
621
- * XML.default_warnings = true|false
622
- *
623
- * Controls whether parsers output warnings by default.
624
- */
625
- static VALUE rxml_default_warnings_set(VALUE class, VALUE bool)
626
- {
627
- if (TYPE(bool) == T_FALSE)
628
- {
629
- xmlGetWarningsDefaultValue = 0;
630
- return (Qfalse);
631
- }
632
- else
633
- {
634
- xmlGetWarningsDefaultValue = 1;
635
- return (Qtrue);
636
- }
637
- }
638
-
639
- /*
640
- * call-seq:
641
- * XML.default_compression -> (true|false)
642
- *
643
- * Determine whether parsers use Zlib compression by default
644
- * (requires libxml to be compiled with Zlib support).
645
- */
646
- static VALUE rxml_default_compression_get(VALUE class)
647
- {
648
- #ifdef HAVE_ZLIB_H
649
- return(INT2FIX(xmlGetCompressMode()));
650
- #else
651
- rb_warn("libxml was compiled without zlib support");
652
- return (Qfalse);
653
- #endif
654
- }
655
-
656
- /*
657
- * call-seq:
658
- * XML.default_compression = true|false
659
- *
660
- * Controls whether parsers use Zlib compression by default
661
- * (requires libxml to be compiled with Zlib support).
662
- */
663
- static VALUE rxml_default_compression_set(VALUE class, VALUE num)
664
- {
665
- #ifdef HAVE_ZLIB_H
666
- Check_Type(num, T_FIXNUM);
667
- xmlSetCompressMode(FIX2INT(num));
668
- return(num);
669
- #else
670
- rb_warn("libxml was compiled without zlib support");
671
- return (Qfalse);
672
- #endif
673
- }
674
-
675
- /*
676
- * call-seq:
677
- * XML.features -> ["feature", ..., "feature"]
678
- *
679
- * Obtains an array of strings representing features supported
680
- * (and enabled) by the installed libxml.
681
- */
682
- static VALUE rxml_features(VALUE class)
683
- {
684
- VALUE arr, str;
685
- int i, len = MAX_LIBXML_FEATURES_LEN;
686
- char **list = NULL;
687
-
688
- list = ALLOC_N(char *,MAX_LIBXML_FEATURES_LEN);
689
- MEMZERO(list, char *, MAX_LIBXML_FEATURES_LEN);
690
-
691
- arr = rb_ary_new();
692
- if (xmlGetFeaturesList(&len, (const char **) list) == -1)
693
- return Qnil;
694
-
695
- for (i = 0; i < len; i++)
696
- {
697
- str = rb_str_new2((const char *) list[i]);
698
- rb_gc_unregister_address(&str);
699
- rb_ary_push(arr, str);
700
- }
701
-
702
- if (len == MAX_LIBXML_FEATURES_LEN)
703
- rb_warn(
704
- "Please contact libxml-devel@rubyforge.org and ask to have the \"MAX_LIBXML_FEATURES_LEN increased\" because you could possibly be seeing an incomplete list");
705
-
706
- ruby_xfree(list);
707
- return (arr);
708
- }
709
-
710
- /*
711
- * call-seq:
712
- * XML.indent_tree_output -> (true|false)
713
- *
714
- * Determines whether XML output will be indented
715
- * (using the string supplied to +default_indent_tree_string+)
716
- */
717
- static VALUE rxml_indent_tree_output_get(VALUE class)
718
- {
719
- if (xmlIndentTreeOutput)
720
- return (Qtrue);
721
- else
722
- return (Qfalse);
723
- }
724
-
725
- /*
726
- * call-seq:
727
- * XML.indent_tree_output = true|false
728
- *
729
- * Controls whether XML output will be indented
730
- * (using the string supplied to +default_indent_tree_string+)
731
- */
732
- static VALUE rxml_indent_tree_output_set(VALUE class, VALUE bool)
733
- {
734
- if (TYPE(bool) == T_TRUE)
735
- {
736
- xmlIndentTreeOutput = 1;
737
- return (Qtrue);
738
- }
739
- else if (TYPE(bool) == T_FALSE)
740
- {
741
- xmlIndentTreeOutput = 0;
742
- return (Qfalse);
743
- }
744
- else
745
- {
746
- rb_raise(rb_eArgError, "Invalid argument, must be boolean");
747
- }
748
- }
749
-
750
- /*
751
- * call-seq:
752
- * XML.memory_dump -> (true|false)
753
- *
754
- * Perform a parser memory dump (requires memory debugging
755
- * support in libxml).
756
- */
757
- static VALUE rxml_memory_dump(VALUE self)
758
- {
759
- #ifdef DEBUG_MEMORY_LOCATION
760
- xmlMemoryDump();
761
- return(Qtrue);
762
- #else
763
- rb_warn("libxml was compiled without memory debugging support");
764
- return (Qfalse);
765
- #endif
766
- }
767
-
768
- /*
769
- * call-seq:
770
- * XML.memory_used -> num_bytes
771
- *
772
- * Perform a parser memory dump (requires memory debugging
773
- * support in libxml).
774
- */
775
- static VALUE rxml_memory_used(VALUE self)
776
- {
777
- #ifdef DEBUG_MEMORY_LOCATION
778
- return(INT2NUM(xmlMemUsed()));
779
- #else
780
- rb_warn("libxml was compiled without memory debugging support");
781
- return (Qfalse);
782
- #endif
783
- }
784
-
785
- #if defined(_WIN32)
786
- __declspec(dllexport)
787
- #endif
788
- void Init_libxml_ruby(void)
789
- {
790
- mLibXML = rb_define_module("LibXML");
791
- mXML = rb_define_module_under(mLibXML, "XML");
792
-
793
- /* Constants */
794
- rb_define_const(mXML, "LIBXML_VERSION", rb_str_new2(LIBXML_DOTTED_VERSION));
795
- rb_define_const(mXML, "VERSION", rb_str_new2(RUBY_LIBXML_VERSION));
796
- rb_define_const(mXML, "VERNUM", INT2NUM(RUBY_LIBXML_VERNUM));
797
- rb_define_const(mXML, "XML_NAMESPACE", rb_str_new2(
798
- (const char*) XML_XML_NAMESPACE));
799
-
800
- rb_define_module_function(mXML, "enabled_automata?", rxml_enabled_automata_q,
801
- 0);
802
- rb_define_module_function(mXML, "enabled_c14n?", rxml_enabled_c14n_q, 0);
803
- rb_define_module_function(mXML, "enabled_catalog?", rxml_enabled_catalog_q, 0);
804
- rb_define_module_function(mXML, "enabled_debug?", rxml_enabled_debug_q, 0);
805
- rb_define_module_function(mXML, "enabled_docbook?", rxml_enabled_docbook_q, 0);
806
- rb_define_module_function(mXML, "enabled_ftp?", rxml_enabled_ftp_q, 0);
807
- rb_define_module_function(mXML, "enabled_http?", rxml_enabled_http_q, 0);
808
- rb_define_module_function(mXML, "enabled_html?", rxml_enabled_html_q, 0);
809
- rb_define_module_function(mXML, "enabled_iconv?", rxml_enabled_iconv_q, 0);
810
- rb_define_module_function(mXML, "enabled_memory_debug?",
811
- rxml_enabled_memory_debug_location_q, 0);
812
- rb_define_module_function(mXML, "enabled_regexp?", rxml_enabled_regexp_q, 0);
813
- rb_define_module_function(mXML, "enabled_schemas?", rxml_enabled_schemas_q, 0);
814
- rb_define_module_function(mXML, "enabled_thread?", rxml_enabled_thread_q, 0);
815
- rb_define_module_function(mXML, "enabled_unicode?", rxml_enabled_unicode_q, 0);
816
- rb_define_module_function(mXML, "enabled_xinclude?", rxml_enabled_xinclude_q,
817
- 0);
818
- rb_define_module_function(mXML, "enabled_xpath?", rxml_enabled_xpath_q, 0);
819
- rb_define_module_function(mXML, "enabled_xpointer?", rxml_enabled_xpointer_q,
820
- 0);
821
- rb_define_module_function(mXML, "enabled_zlib?", rxml_enabled_zlib_q, 0);
822
-
823
- rb_define_module_function(mXML, "catalog_dump", rxml_catalog_dump, 0);
824
- rb_define_module_function(mXML, "catalog_remove", rxml_catalog_remove, 1);
825
- rb_define_module_function(mXML, "check_lib_versions",
826
- rxml_check_lib_versions, 0);
827
- rb_define_module_function(mXML, "debug_entities", rxml_debug_entities_get, 0);
828
- rb_define_module_function(mXML, "debug_entities=", rxml_debug_entities_set, 1);
829
- rb_define_module_function(mXML, "default_compression",
830
- rxml_default_compression_get, 0);
831
- rb_define_module_function(mXML, "default_compression=",
832
- rxml_default_compression_set, 1);
833
- rb_define_module_function(mXML, "default_keep_blanks",
834
- rxml_default_keep_blanks_get, 0);
835
- rb_define_module_function(mXML, "default_keep_blanks=",
836
- rxml_default_keep_blanks_set, 1);
837
- rb_define_module_function(mXML, "default_load_external_dtd",
838
- rxml_default_load_external_dtd_get, 0);
839
- rb_define_module_function(mXML, "default_load_external_dtd=",
840
- rxml_default_load_external_dtd_set, 1);
841
- rb_define_module_function(mXML, "default_line_numbers",
842
- rxml_default_line_numbers_get, 0);
843
- rb_define_module_function(mXML, "default_line_numbers=",
844
- rxml_default_line_numbers_set, 1);
845
- rb_define_module_function(mXML, "default_pedantic_parser",
846
- rxml_default_pedantic_parser_get, 0);
847
- rb_define_module_function(mXML, "default_pedantic_parser=",
848
- rxml_default_pedantic_parser_set, 1);
849
- rb_define_module_function(mXML, "default_substitute_entities",
850
- rxml_default_substitute_entities_get, 0);
851
- rb_define_module_function(mXML, "default_substitute_entities=",
852
- rxml_default_substitute_entities_set, 1);
853
- rb_define_module_function(mXML, "default_tree_indent_string",
854
- rxml_default_tree_indent_string_get, 0);
855
- rb_define_module_function(mXML, "default_tree_indent_string=",
856
- rxml_default_tree_indent_string_set, 1);
857
- rb_define_module_function(mXML, "default_validity_checking",
858
- rxml_default_validity_checking_get, 0);
859
- rb_define_module_function(mXML, "default_validity_checking=",
860
- rxml_default_validity_checking_set, 1);
861
- rb_define_module_function(mXML, "default_warnings",
862
- rxml_default_warnings_get, 0);
863
- rb_define_module_function(mXML, "default_warnings=",
864
- rxml_default_warnings_set, 1);
865
- rb_define_module_function(mXML, "features", rxml_features, 0);
866
- rb_define_module_function(mXML, "indent_tree_output",
867
- rxml_indent_tree_output_get, 0);
868
- rb_define_module_function(mXML, "indent_tree_output=",
869
- rxml_indent_tree_output_set, 1);
870
- rb_define_module_function(mXML, "memory_dump", rxml_memory_dump, 0);
871
- rb_define_module_function(mXML, "memory_used", rxml_memory_used, 0);
872
-
873
- /* Now initialize all the other modules */
874
- ruby_init_xml_error();
875
- ruby_init_xml_input();
876
- ruby_init_state();
877
- ruby_init_parser();
878
- ruby_init_xml_parser_context();
879
- ruby_init_xml_node();
880
- ruby_init_xml_attributes();
881
- ruby_init_xml_attr();
882
- ruby_init_xml_document();
883
- ruby_init_xml_ns();
884
- ruby_init_xml_sax_parser();
885
- ruby_init_xml_xinclude();
886
- ruby_init_xml_xpath();
887
- ruby_init_xml_xpath_context();
888
- ruby_init_xml_xpath_expression();
889
- ruby_init_xml_xpointer();
890
- ruby_init_html_parser();
891
- ruby_init_input_callbacks();
892
- ruby_init_xml_dtd();
893
- ruby_init_xml_schema();
894
- ruby_init_xml_relaxng();
895
- ruby_init_xml_reader();
896
-
897
- rxml_default_substitute_entities_set(mXML, Qtrue);
898
- rxml_default_load_external_dtd_set(mXML, Qtrue);
899
- }
1
+ /* $Id: libxml.c 666 2008-12-07 00:16:50Z cfis $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #include "ruby_libxml.h"
6
+
7
+ VALUE mLibXML;
8
+ VALUE mXML;
9
+
10
+ /*
11
+ * call-seq:
12
+ * XML.catalog_dump -> true
13
+ *
14
+ * Dump all the global catalog content stdout.
15
+ */
16
+ static VALUE rxml_catalog_dump(VALUE self)
17
+ {
18
+ xmlCatalogDump(stdout);
19
+ return (Qtrue);
20
+ }
21
+
22
+ /*
23
+ * call-seq:
24
+ * XML.catalog_remove(catalog) -> true
25
+ *
26
+ * Remove the specified resource catalog.
27
+ */
28
+ static VALUE rxml_catalog_remove(VALUE self, VALUE cat)
29
+ {
30
+ Check_Type(cat, T_STRING);
31
+ xmlCatalogRemove((xmlChar *) StringValuePtr(cat));
32
+ return (Qtrue);
33
+ }
34
+
35
+ /*
36
+ * call-seq:
37
+ * XML.check_lib_versions -> true
38
+ *
39
+ * Check LIBXML version matches version the bindings
40
+ * were compiled to. Throws an exception if not.
41
+ */
42
+ static VALUE rxml_check_lib_versions(VALUE class)
43
+ {
44
+ xmlCheckVersion(LIBXML_VERSION);
45
+ return (Qtrue);
46
+ }
47
+
48
+ /*
49
+ * call-seq:
50
+ * XML.enabled_automata? -> (true|false)
51
+ *
52
+ * Determine whether libxml regexp automata support is enabled.
53
+ */
54
+ static VALUE rxml_enabled_automata_q(VALUE class)
55
+ {
56
+ #ifdef LIBXML_AUTOMATA_ENABLED
57
+ return(Qtrue);
58
+ #else
59
+ return (Qfalse);
60
+ #endif
61
+ }
62
+
63
+ /*
64
+ * call-seq:
65
+ * XML.enabled_c14n? -> (true|false)
66
+ *
67
+ * Determine whether libxml 'canonical XML' support is enabled.
68
+ * See "Canonical XML" (http://www.w3.org/TR/xml-c14n)
69
+ */
70
+ static VALUE rxml_enabled_c14n_q(VALUE class)
71
+ {
72
+ #ifdef LIBXML_C14N_ENABLED
73
+ return(Qtrue);
74
+ #else
75
+ return (Qfalse);
76
+ #endif
77
+ }
78
+
79
+ /*
80
+ * call-seq:
81
+ * XML.enabled_catalog? -> (true|false)
82
+ *
83
+ * Determine whether libxml resource catalog support is enabled.
84
+ */
85
+ static VALUE rxml_enabled_catalog_q(VALUE class)
86
+ {
87
+ #ifdef LIBXML_CATALOG_ENABLED
88
+ return(Qtrue);
89
+ #else
90
+ return (Qfalse);
91
+ #endif
92
+ }
93
+
94
+ /*
95
+ * call-seq:
96
+ * XML.enabled_debug? -> (true|false)
97
+ *
98
+ * Determine whether libxml debugging support is enabled.
99
+ */
100
+ static VALUE rxml_enabled_debug_q(VALUE class)
101
+ {
102
+ #ifdef LIBXML_DEBUG_ENABLED
103
+ return(Qtrue);
104
+ #else
105
+ return (Qfalse);
106
+ #endif
107
+ }
108
+
109
+ /*
110
+ * call-seq:
111
+ * XML.enabled_docbook? -> (true|false)
112
+ *
113
+ * Determine whether libxml docbook support is enabled.
114
+ */
115
+ static VALUE rxml_enabled_docbook_q(VALUE class)
116
+ {
117
+ #ifdef LIBXML_DOCB_ENABLED
118
+ return(Qtrue);
119
+ #else
120
+ return (Qfalse);
121
+ #endif
122
+ }
123
+
124
+ /*
125
+ * call-seq:
126
+ * XML.enabled_ftp? -> (true|false)
127
+ *
128
+ * Determine whether libxml ftp client support is enabled.
129
+ */
130
+ static VALUE rxml_enabled_ftp_q(VALUE class)
131
+ {
132
+ #ifdef LIBXML_FTP_ENABLED
133
+ return(Qtrue);
134
+ #else
135
+ return (Qfalse);
136
+ #endif
137
+ }
138
+
139
+ /*
140
+ * call-seq:
141
+ * XML.enabled_http? -> (true|false)
142
+ *
143
+ * Determine whether libxml http client support is enabled.
144
+ */
145
+ static VALUE rxml_enabled_http_q(VALUE class)
146
+ {
147
+ #ifdef LIBXML_HTTP_ENABLED
148
+ return(Qtrue);
149
+ #else
150
+ return (Qfalse);
151
+ #endif
152
+ }
153
+
154
+ /*
155
+ * call-seq:
156
+ * XML.enabled_html? -> (true|false)
157
+ *
158
+ * Determine whether libxml html support is enabled.
159
+ */
160
+ static VALUE rxml_enabled_html_q(VALUE class)
161
+ {
162
+ #ifdef LIBXML_HTML_ENABLED
163
+ return(Qtrue);
164
+ #else
165
+ return (Qfalse);
166
+ #endif
167
+ }
168
+
169
+ /*
170
+ * call-seq:
171
+ * XML.enabled_iconv? -> (true|false)
172
+ *
173
+ * Determine whether libxml iconv support is enabled.
174
+ */
175
+ static VALUE rxml_enabled_iconv_q(VALUE class)
176
+ {
177
+ #ifdef LIBXML_ICONV_ENABLED
178
+ return(Qtrue);
179
+ #else
180
+ return (Qfalse);
181
+ #endif
182
+ }
183
+
184
+ /*
185
+ * call-seq:
186
+ * XML.enabled_memory_debug? -> (true|false)
187
+ *
188
+ * Determine whether libxml memory location debugging support
189
+ * is enabled.
190
+ */
191
+ static VALUE rxml_enabled_memory_debug_location_q(VALUE class)
192
+ {
193
+ #ifdef DEBUG_MEMORY_LOCATION
194
+ return(Qtrue);
195
+ #else
196
+ return (Qfalse);
197
+ #endif
198
+ }
199
+
200
+ /*
201
+ * call-seq:
202
+ * XML.enabled_regexp? -> (true|false)
203
+ *
204
+ * Determine whether libxml regular expression support is enabled.
205
+ */
206
+ static VALUE rxml_enabled_regexp_q(VALUE class)
207
+ {
208
+ #ifdef LIBXML_REGEXP_ENABLED
209
+ return(Qtrue);
210
+ #else
211
+ return (Qfalse);
212
+ #endif
213
+ }
214
+
215
+ /*
216
+ * call-seq:
217
+ * XML.enabled_schemas? -> (true|false)
218
+ *
219
+ * Determine whether libxml schema support is enabled.
220
+ */
221
+ static VALUE rxml_enabled_schemas_q(VALUE class)
222
+ {
223
+ #ifdef LIBXML_SCHEMAS_ENABLED
224
+ return(Qtrue);
225
+ #else
226
+ return (Qfalse);
227
+ #endif
228
+ }
229
+
230
+ /*
231
+ * call-seq:
232
+ * XML.enabled_thread? -> (true|false)
233
+ *
234
+ * Determine whether libxml thread-safe semantics support
235
+ * is enabled (I think?).
236
+ */
237
+ static VALUE rxml_enabled_thread_q(VALUE class)
238
+ {
239
+ #ifdef LIBXML_THREAD_ENABLED
240
+ return(Qtrue);
241
+ #else
242
+ return (Qfalse);
243
+ #endif
244
+ }
245
+
246
+ /*
247
+ * call-seq:
248
+ * XML.enabled_unicode? -> (true|false)
249
+ *
250
+ * Determine whether libxml unicode support is enabled.
251
+ */
252
+ static VALUE rxml_enabled_unicode_q(VALUE class)
253
+ {
254
+ #ifdef LIBXML_UNICODE_ENABLED
255
+ return(Qtrue);
256
+ #else
257
+ return (Qfalse);
258
+ #endif
259
+ }
260
+
261
+ /*
262
+ * call-seq:
263
+ * XML.enabled_xinclude? -> (true|false)
264
+ *
265
+ * Determine whether libxml xinclude support is enabled.
266
+ */
267
+ static VALUE rxml_enabled_xinclude_q(VALUE class)
268
+ {
269
+ #ifdef LIBXML_XINCLUDE_ENABLED
270
+ return(Qtrue);
271
+ #else
272
+ return (Qfalse);
273
+ #endif
274
+ }
275
+
276
+ /*
277
+ * call-seq:
278
+ * XML.enabled_xpath? -> (true|false)
279
+ *
280
+ * Determine whether libxml xpath support is enabled.
281
+ */
282
+ static VALUE rxml_enabled_xpath_q(VALUE class)
283
+ {
284
+ #ifdef LIBXML_XPATH_ENABLED
285
+ return(Qtrue);
286
+ #else
287
+ return (Qfalse);
288
+ #endif
289
+ }
290
+
291
+ /*
292
+ * call-seq:
293
+ * XML.enabled_xpointer? -> (true|false)
294
+ *
295
+ * Determine whether libxml xpointer support is enabled.
296
+ */
297
+ static VALUE rxml_enabled_xpointer_q(VALUE class)
298
+ {
299
+ #ifdef LIBXML_XPTR_ENABLED
300
+ return(Qtrue);
301
+ #else
302
+ return (Qfalse);
303
+ #endif
304
+ }
305
+
306
+ /*
307
+ * call-seq:
308
+ * XML.enabled_zlib? -> (true|false)
309
+ *
310
+ * Determine whether libxml zlib support is enabled.
311
+ */
312
+ static VALUE rxml_enabled_zlib_q(VALUE class)
313
+ {
314
+ #ifdef HAVE_ZLIB_H
315
+ return(Qtrue);
316
+ #else
317
+ return (Qfalse);
318
+ #endif
319
+ }
320
+
321
+ /*
322
+ * call-seq:
323
+ * XML.debug_entities -> (true|false)
324
+ *
325
+ * Determine whether included-entity debugging is enabled.
326
+ * (Requires Libxml to be compiled with debugging support)
327
+ */
328
+ static VALUE rxml_debug_entities_get(VALUE class)
329
+ {
330
+ #ifdef LIBXML_DEBUG_ENABLED
331
+ if (xmlParserDebugEntities)
332
+ return(Qtrue);
333
+ else
334
+ return(Qfalse);
335
+ #else
336
+ rb_warn("libxml was compiled with debugging turned off");
337
+ return (Qfalse);
338
+ #endif
339
+ }
340
+
341
+ /*
342
+ * call-seq:
343
+ * XML.debug_entities = true|false
344
+ *
345
+ * Enable or disable included-entity debugging.
346
+ * (Requires Libxml to be compiled with debugging support)
347
+ */
348
+ static VALUE rxml_debug_entities_set(VALUE class, VALUE bool)
349
+ {
350
+ #ifdef LIBXML_DEBUG_ENABLED
351
+ if (TYPE(bool) == T_FALSE)
352
+ {
353
+ xmlParserDebugEntities = 0;
354
+ return(Qfalse);
355
+ }
356
+ else
357
+ {
358
+ xmlParserDebugEntities = 1;
359
+ return(Qtrue);
360
+ }
361
+ #else
362
+ rb_warn("libxml was compiled with debugging turned off");
363
+ #endif
364
+ }
365
+
366
+ /*
367
+ * call-seq:
368
+ * XML.default_keep_blanks -> (true|false)
369
+ *
370
+ * Determine whether parsers retain whitespace by default.
371
+ */
372
+ static VALUE rxml_default_keep_blanks_get(VALUE class)
373
+ {
374
+ if (xmlKeepBlanksDefaultValue)
375
+ return (Qtrue);
376
+ else
377
+ return (Qfalse);
378
+ }
379
+
380
+ /*
381
+ * call-seq:
382
+ * XML.default_keep_blanks = true|false
383
+ *
384
+ * Controls whether parsers retain whitespace by default.
385
+ */
386
+ static VALUE rxml_default_keep_blanks_set(VALUE class, VALUE bool)
387
+ {
388
+ if (TYPE(bool) == T_FALSE)
389
+ {
390
+ xmlKeepBlanksDefaultValue = 0;
391
+ return (Qfalse);
392
+ }
393
+ else if (TYPE(bool) == T_TRUE)
394
+ {
395
+ xmlKeepBlanksDefaultValue = 1;
396
+ return (Qtrue);
397
+ }
398
+ else
399
+ {
400
+ rb_raise(rb_eArgError, "Invalid argument, must be a boolean");
401
+ }
402
+ }
403
+
404
+ /*
405
+ * call-seq:
406
+ * XML.default_load_external_dtd -> (true|false)
407
+ *
408
+ * Determine whether parsers load external DTDs by default.
409
+ */
410
+ static VALUE rxml_default_load_external_dtd_get(VALUE class)
411
+ {
412
+ if (xmlLoadExtDtdDefaultValue)
413
+ return (Qtrue);
414
+ else
415
+ return (Qfalse);
416
+ }
417
+
418
+ /*
419
+ * call-seq:
420
+ * XML.default_load_external_dtd = true|false
421
+ *
422
+ * Controls whether parsers load external DTDs by default.
423
+ */
424
+ static VALUE rxml_default_load_external_dtd_set(VALUE class, VALUE bool)
425
+ {
426
+ if (TYPE(bool) == T_FALSE)
427
+ {
428
+ xmlLoadExtDtdDefaultValue = 0;
429
+ return (Qfalse);
430
+ }
431
+ else
432
+ {
433
+ xmlLoadExtDtdDefaultValue = 1;
434
+ return (Qtrue);
435
+ }
436
+ }
437
+
438
+ /*
439
+ * call-seq:
440
+ * XML.default_line_numbers -> (true|false)
441
+ *
442
+ * Determine whether parsers retain line-numbers by default.
443
+ */
444
+ static VALUE rxml_default_line_numbers_get(VALUE class)
445
+ {
446
+ if (xmlLineNumbersDefaultValue)
447
+ return (Qtrue);
448
+ else
449
+ return (Qfalse);
450
+ }
451
+
452
+ /*
453
+ * call-seq:
454
+ * XML.default_line_numbers = true|false
455
+ *
456
+ * Controls whether parsers retain line-numbers by default.
457
+ */
458
+ static VALUE rxml_default_line_numbers_set(VALUE class, VALUE bool)
459
+ {
460
+ if (TYPE(bool) == T_FALSE)
461
+ {
462
+ xmlLineNumbersDefault(0);
463
+ return (Qfalse);
464
+ }
465
+ else
466
+ {
467
+ xmlLineNumbersDefault(1);
468
+ return (Qtrue);
469
+ }
470
+ }
471
+
472
+ /*
473
+ * call-seq:
474
+ * XML.default_pedantic_parser -> (true|false)
475
+ *
476
+ * Determine whether parsers are pedantic by default.
477
+ */
478
+ static VALUE rxml_default_pedantic_parser_get(VALUE class)
479
+ {
480
+ if (xmlPedanticParserDefaultValue)
481
+ return (Qtrue);
482
+ else
483
+ return (Qfalse);
484
+ }
485
+
486
+ /*
487
+ * call-seq:
488
+ * XML.default_pedantic_parser = true|false
489
+ *
490
+ * Controls whether parsers are pedantic by default.
491
+ */
492
+ static VALUE rxml_default_pedantic_parser_set(VALUE class, VALUE bool)
493
+ {
494
+ if (TYPE(bool) == T_FALSE)
495
+ {
496
+ xmlPedanticParserDefault(0);
497
+ return (Qfalse);
498
+ }
499
+ else
500
+ {
501
+ xmlPedanticParserDefault(1);
502
+ return (Qtrue);
503
+ }
504
+ }
505
+
506
+ /*
507
+ * call-seq:
508
+ * XML.default_substitute_entities -> (true|false)
509
+ *
510
+ * Determine whether parsers perform inline entity substitution
511
+ * (for external entities) by default.
512
+ */
513
+ static VALUE rxml_default_substitute_entities_get(VALUE class)
514
+ {
515
+ if (xmlSubstituteEntitiesDefaultValue)
516
+ return (Qtrue);
517
+ else
518
+ return (Qfalse);
519
+ }
520
+
521
+ /*
522
+ * call-seq:
523
+ * XML.default_substitute_entities = true|false
524
+ *
525
+ * Controls whether parsers perform inline entity substitution
526
+ * (for external entities) by default.
527
+ */
528
+ static VALUE rxml_default_substitute_entities_set(VALUE class, VALUE bool)
529
+ {
530
+ if (TYPE(bool) == T_FALSE)
531
+ {
532
+ xmlSubstituteEntitiesDefault(0);
533
+ return (Qfalse);
534
+ }
535
+ else
536
+ {
537
+ xmlSubstituteEntitiesDefault(1);
538
+ return (Qtrue);
539
+ }
540
+ }
541
+
542
+ /*
543
+ * call-seq:
544
+ * XML.default_tree_indent_string -> "string"
545
+ *
546
+ * Obtain the default string used by parsers to indent the XML tree
547
+ * for output.
548
+ */
549
+ static VALUE rxml_default_tree_indent_string_get(VALUE class)
550
+ {
551
+ if (xmlTreeIndentString == NULL)
552
+ return (Qnil);
553
+ else
554
+ return (rb_str_new2(xmlTreeIndentString));
555
+ }
556
+
557
+ /*
558
+ * call-seq:
559
+ * XML.default_tree_indent_string = "string"
560
+ *
561
+ * Set the default string used by parsers to indent the XML tree
562
+ * for output.
563
+ */
564
+ static VALUE rxml_default_tree_indent_string_set(VALUE class, VALUE string)
565
+ {
566
+ Check_Type(string, T_STRING);
567
+ xmlTreeIndentString = xmlStrdup((xmlChar *)StringValuePtr(string));
568
+ return (string);
569
+ }
570
+
571
+ /*
572
+ * call-seq:
573
+ * XML.default_validity_checking -> (true|false)
574
+ *
575
+ * Determine whether parsers perform XML validation by default.
576
+ */
577
+ static VALUE rxml_default_validity_checking_get(VALUE class)
578
+ {
579
+ if (xmlDoValidityCheckingDefaultValue)
580
+ return (Qtrue);
581
+ else
582
+ return (Qfalse);
583
+ }
584
+
585
+ /*
586
+ * call-seq:
587
+ * XML.default_validity_checking = true|false
588
+ *
589
+ * Controls whether parsers perform XML validation by default.
590
+ */
591
+ static VALUE rxml_default_validity_checking_set(VALUE class, VALUE bool)
592
+ {
593
+ if (TYPE(bool) == T_FALSE)
594
+ {
595
+ xmlDoValidityCheckingDefaultValue = 0;
596
+ return (Qfalse);
597
+ }
598
+ else
599
+ {
600
+ xmlDoValidityCheckingDefaultValue = 1;
601
+ return (Qtrue);
602
+ }
603
+ }
604
+
605
+ /*
606
+ * call-seq:
607
+ * XML.default_warnings -> (true|false)
608
+ *
609
+ * Determine whether parsers output warnings by default.
610
+ */
611
+ static VALUE rxml_default_warnings_get(VALUE class)
612
+ {
613
+ if (xmlGetWarningsDefaultValue)
614
+ return (Qtrue);
615
+ else
616
+ return (Qfalse);
617
+ }
618
+
619
+ /*
620
+ * call-seq:
621
+ * XML.default_warnings = true|false
622
+ *
623
+ * Controls whether parsers output warnings by default.
624
+ */
625
+ static VALUE rxml_default_warnings_set(VALUE class, VALUE bool)
626
+ {
627
+ if (TYPE(bool) == T_FALSE)
628
+ {
629
+ xmlGetWarningsDefaultValue = 0;
630
+ return (Qfalse);
631
+ }
632
+ else
633
+ {
634
+ xmlGetWarningsDefaultValue = 1;
635
+ return (Qtrue);
636
+ }
637
+ }
638
+
639
+ /*
640
+ * call-seq:
641
+ * XML.default_compression -> (true|false)
642
+ *
643
+ * Determine whether parsers use Zlib compression by default
644
+ * (requires libxml to be compiled with Zlib support).
645
+ */
646
+ static VALUE rxml_default_compression_get(VALUE class)
647
+ {
648
+ #ifdef HAVE_ZLIB_H
649
+ return(INT2FIX(xmlGetCompressMode()));
650
+ #else
651
+ rb_warn("libxml was compiled without zlib support");
652
+ return (Qfalse);
653
+ #endif
654
+ }
655
+
656
+ /*
657
+ * call-seq:
658
+ * XML.default_compression = true|false
659
+ *
660
+ * Controls whether parsers use Zlib compression by default
661
+ * (requires libxml to be compiled with Zlib support).
662
+ */
663
+ static VALUE rxml_default_compression_set(VALUE class, VALUE num)
664
+ {
665
+ #ifdef HAVE_ZLIB_H
666
+ Check_Type(num, T_FIXNUM);
667
+ xmlSetCompressMode(FIX2INT(num));
668
+ return(num);
669
+ #else
670
+ rb_warn("libxml was compiled without zlib support");
671
+ return (Qfalse);
672
+ #endif
673
+ }
674
+
675
+ /*
676
+ * call-seq:
677
+ * XML.features -> ["feature", ..., "feature"]
678
+ *
679
+ * Obtains an array of strings representing features supported
680
+ * (and enabled) by the installed libxml.
681
+ */
682
+ static VALUE rxml_features(VALUE class)
683
+ {
684
+ VALUE arr, str;
685
+ int i, len = MAX_LIBXML_FEATURES_LEN;
686
+ char **list = NULL;
687
+
688
+ list = ALLOC_N(char *,MAX_LIBXML_FEATURES_LEN);
689
+ MEMZERO(list, char *, MAX_LIBXML_FEATURES_LEN);
690
+
691
+ arr = rb_ary_new();
692
+ if (xmlGetFeaturesList(&len, (const char **) list) == -1)
693
+ return Qnil;
694
+
695
+ for (i = 0; i < len; i++)
696
+ {
697
+ str = rb_str_new2((const char *) list[i]);
698
+ rb_gc_unregister_address(&str);
699
+ rb_ary_push(arr, str);
700
+ }
701
+
702
+ if (len == MAX_LIBXML_FEATURES_LEN)
703
+ rb_warn(
704
+ "Please contact libxml-devel@rubyforge.org and ask to have the \"MAX_LIBXML_FEATURES_LEN increased\" because you could possibly be seeing an incomplete list");
705
+
706
+ ruby_xfree(list);
707
+ return (arr);
708
+ }
709
+
710
+ /*
711
+ * call-seq:
712
+ * XML.indent_tree_output -> (true|false)
713
+ *
714
+ * Determines whether XML output will be indented
715
+ * (using the string supplied to +default_indent_tree_string+)
716
+ */
717
+ static VALUE rxml_indent_tree_output_get(VALUE class)
718
+ {
719
+ if (xmlIndentTreeOutput)
720
+ return (Qtrue);
721
+ else
722
+ return (Qfalse);
723
+ }
724
+
725
+ /*
726
+ * call-seq:
727
+ * XML.indent_tree_output = true|false
728
+ *
729
+ * Controls whether XML output will be indented
730
+ * (using the string supplied to +default_indent_tree_string+)
731
+ */
732
+ static VALUE rxml_indent_tree_output_set(VALUE class, VALUE bool)
733
+ {
734
+ if (TYPE(bool) == T_TRUE)
735
+ {
736
+ xmlIndentTreeOutput = 1;
737
+ return (Qtrue);
738
+ }
739
+ else if (TYPE(bool) == T_FALSE)
740
+ {
741
+ xmlIndentTreeOutput = 0;
742
+ return (Qfalse);
743
+ }
744
+ else
745
+ {
746
+ rb_raise(rb_eArgError, "Invalid argument, must be boolean");
747
+ }
748
+ }
749
+
750
+ /*
751
+ * call-seq:
752
+ * XML.memory_dump -> (true|false)
753
+ *
754
+ * Perform a parser memory dump (requires memory debugging
755
+ * support in libxml).
756
+ */
757
+ static VALUE rxml_memory_dump(VALUE self)
758
+ {
759
+ #ifdef DEBUG_MEMORY_LOCATION
760
+ xmlMemoryDump();
761
+ return(Qtrue);
762
+ #else
763
+ rb_warn("libxml was compiled without memory debugging support");
764
+ return (Qfalse);
765
+ #endif
766
+ }
767
+
768
+ /*
769
+ * call-seq:
770
+ * XML.memory_used -> num_bytes
771
+ *
772
+ * Perform a parser memory dump (requires memory debugging
773
+ * support in libxml).
774
+ */
775
+ static VALUE rxml_memory_used(VALUE self)
776
+ {
777
+ #ifdef DEBUG_MEMORY_LOCATION
778
+ return(INT2NUM(xmlMemUsed()));
779
+ #else
780
+ rb_warn("libxml was compiled without memory debugging support");
781
+ return (Qfalse);
782
+ #endif
783
+ }
784
+
785
+ #if defined(_WIN32)
786
+ __declspec(dllexport)
787
+ #endif
788
+ void Init_libxml_ruby(void)
789
+ {
790
+ mLibXML = rb_define_module("LibXML");
791
+ mXML = rb_define_module_under(mLibXML, "XML");
792
+
793
+ /* Constants */
794
+ rb_define_const(mXML, "LIBXML_VERSION", rb_str_new2(LIBXML_DOTTED_VERSION));
795
+ rb_define_const(mXML, "VERSION", rb_str_new2(RUBY_LIBXML_VERSION));
796
+ rb_define_const(mXML, "VERNUM", INT2NUM(RUBY_LIBXML_VERNUM));
797
+ rb_define_const(mXML, "XML_NAMESPACE", rb_str_new2(
798
+ (const char*) XML_XML_NAMESPACE));
799
+
800
+ rb_define_module_function(mXML, "enabled_automata?", rxml_enabled_automata_q, 0);
801
+ rb_define_module_function(mXML, "enabled_c14n?", rxml_enabled_c14n_q, 0);
802
+ rb_define_module_function(mXML, "enabled_catalog?", rxml_enabled_catalog_q, 0);
803
+ rb_define_module_function(mXML, "enabled_debug?", rxml_enabled_debug_q, 0);
804
+ rb_define_module_function(mXML, "enabled_docbook?", rxml_enabled_docbook_q, 0);
805
+ rb_define_module_function(mXML, "enabled_ftp?", rxml_enabled_ftp_q, 0);
806
+ rb_define_module_function(mXML, "enabled_http?", rxml_enabled_http_q, 0);
807
+ rb_define_module_function(mXML, "enabled_html?", rxml_enabled_html_q, 0);
808
+ rb_define_module_function(mXML, "enabled_iconv?", rxml_enabled_iconv_q, 0);
809
+ rb_define_module_function(mXML, "enabled_memory_debug?", rxml_enabled_memory_debug_location_q, 0);
810
+ rb_define_module_function(mXML, "enabled_regexp?", rxml_enabled_regexp_q, 0);
811
+ rb_define_module_function(mXML, "enabled_schemas?", rxml_enabled_schemas_q, 0);
812
+ rb_define_module_function(mXML, "enabled_thread?", rxml_enabled_thread_q, 0);
813
+ rb_define_module_function(mXML, "enabled_unicode?", rxml_enabled_unicode_q, 0);
814
+ rb_define_module_function(mXML, "enabled_xinclude?", rxml_enabled_xinclude_q, 0);
815
+ rb_define_module_function(mXML, "enabled_xpath?", rxml_enabled_xpath_q, 0);
816
+ rb_define_module_function(mXML, "enabled_xpointer?", rxml_enabled_xpointer_q, 0);
817
+ rb_define_module_function(mXML, "enabled_zlib?", rxml_enabled_zlib_q, 0);
818
+
819
+ rb_define_module_function(mXML, "catalog_dump", rxml_catalog_dump, 0);
820
+ rb_define_module_function(mXML, "catalog_remove", rxml_catalog_remove, 1);
821
+ rb_define_module_function(mXML, "check_lib_versions", rxml_check_lib_versions, 0);
822
+ rb_define_module_function(mXML, "debug_entities", rxml_debug_entities_get, 0);
823
+ rb_define_module_function(mXML, "debug_entities=", rxml_debug_entities_set, 1);
824
+ rb_define_module_function(mXML, "default_compression", rxml_default_compression_get, 0);
825
+ rb_define_module_function(mXML, "default_compression=", rxml_default_compression_set, 1);
826
+ rb_define_module_function(mXML, "default_keep_blanks", rxml_default_keep_blanks_get, 0);
827
+ rb_define_module_function(mXML, "default_keep_blanks=", rxml_default_keep_blanks_set, 1);
828
+ rb_define_module_function(mXML, "default_load_external_dtd", rxml_default_load_external_dtd_get, 0);
829
+ rb_define_module_function(mXML, "default_load_external_dtd=", rxml_default_load_external_dtd_set, 1);
830
+ rb_define_module_function(mXML, "default_line_numbers", rxml_default_line_numbers_get, 0);
831
+ rb_define_module_function(mXML, "default_line_numbers=", rxml_default_line_numbers_set, 1);
832
+ rb_define_module_function(mXML, "default_pedantic_parser", rxml_default_pedantic_parser_get, 0);
833
+ rb_define_module_function(mXML, "default_pedantic_parser=", rxml_default_pedantic_parser_set, 1);
834
+ rb_define_module_function(mXML, "default_substitute_entities", rxml_default_substitute_entities_get, 0);
835
+ rb_define_module_function(mXML, "default_substitute_entities=", rxml_default_substitute_entities_set, 1);
836
+ rb_define_module_function(mXML, "default_tree_indent_string", rxml_default_tree_indent_string_get, 0);
837
+ rb_define_module_function(mXML, "default_tree_indent_string=", rxml_default_tree_indent_string_set, 1);
838
+ rb_define_module_function(mXML, "default_validity_checking", rxml_default_validity_checking_get, 0);
839
+ rb_define_module_function(mXML, "default_validity_checking=", rxml_default_validity_checking_set, 1);
840
+ rb_define_module_function(mXML, "default_warnings", rxml_default_warnings_get, 0);
841
+ rb_define_module_function(mXML, "default_warnings=", rxml_default_warnings_set, 1);
842
+ rb_define_module_function(mXML, "features", rxml_features, 0);
843
+ rb_define_module_function(mXML, "indent_tree_output", rxml_indent_tree_output_get, 0);
844
+ rb_define_module_function(mXML, "indent_tree_output=", rxml_indent_tree_output_set, 1);
845
+ rb_define_module_function(mXML, "memory_dump", rxml_memory_dump, 0);
846
+ rb_define_module_function(mXML, "memory_used", rxml_memory_used, 0);
847
+
848
+ /* Now initialize all the other modules */
849
+ ruby_init_xml_error();
850
+ ruby_init_xml_input();
851
+ ruby_init_state();
852
+ ruby_init_parser();
853
+ ruby_init_xml_parser_context();
854
+ ruby_init_xml_node();
855
+ ruby_init_xml_attributes();
856
+ ruby_init_xml_attr();
857
+ ruby_init_xml_document();
858
+ ruby_init_xml_namespaces();
859
+ ruby_init_xml_namespace();
860
+ ruby_init_xml_sax_parser();
861
+ ruby_init_xml_xinclude();
862
+ ruby_init_xml_xpath();
863
+ ruby_init_xml_xpath_context();
864
+ ruby_init_xml_xpath_expression();
865
+ ruby_init_xml_xpointer();
866
+ ruby_init_html_parser();
867
+ ruby_init_input_callbacks();
868
+ ruby_init_xml_dtd();
869
+ ruby_init_xml_schema();
870
+ ruby_init_xml_relaxng();
871
+ ruby_init_xml_reader();
872
+
873
+ rxml_default_substitute_entities_set(mXML, Qtrue);
874
+ rxml_default_load_external_dtd_set(mXML, Qtrue);
875
+ }