libxml-ruby 3.2.2-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +7 -0
  2. data/HISTORY +848 -0
  3. data/LICENSE +21 -0
  4. data/MANIFEST +166 -0
  5. data/README.rdoc +217 -0
  6. data/Rakefile +99 -0
  7. data/ext/libxml/extconf.rb +61 -0
  8. data/ext/libxml/libxml.c +80 -0
  9. data/ext/libxml/libxml_ruby.def +35 -0
  10. data/ext/libxml/ruby_libxml.h +67 -0
  11. data/ext/libxml/ruby_xml.c +933 -0
  12. data/ext/libxml/ruby_xml.h +10 -0
  13. data/ext/libxml/ruby_xml_attr.c +333 -0
  14. data/ext/libxml/ruby_xml_attr.h +12 -0
  15. data/ext/libxml/ruby_xml_attr_decl.c +153 -0
  16. data/ext/libxml/ruby_xml_attr_decl.h +11 -0
  17. data/ext/libxml/ruby_xml_attributes.c +275 -0
  18. data/ext/libxml/ruby_xml_attributes.h +15 -0
  19. data/ext/libxml/ruby_xml_cbg.c +85 -0
  20. data/ext/libxml/ruby_xml_document.c +1123 -0
  21. data/ext/libxml/ruby_xml_document.h +11 -0
  22. data/ext/libxml/ruby_xml_dtd.c +248 -0
  23. data/ext/libxml/ruby_xml_dtd.h +9 -0
  24. data/ext/libxml/ruby_xml_encoding.c +250 -0
  25. data/ext/libxml/ruby_xml_encoding.h +16 -0
  26. data/ext/libxml/ruby_xml_error.c +996 -0
  27. data/ext/libxml/ruby_xml_error.h +12 -0
  28. data/ext/libxml/ruby_xml_html_parser.c +89 -0
  29. data/ext/libxml/ruby_xml_html_parser.h +10 -0
  30. data/ext/libxml/ruby_xml_html_parser_context.c +337 -0
  31. data/ext/libxml/ruby_xml_html_parser_context.h +10 -0
  32. data/ext/libxml/ruby_xml_html_parser_options.c +46 -0
  33. data/ext/libxml/ruby_xml_html_parser_options.h +10 -0
  34. data/ext/libxml/ruby_xml_input_cbg.c +191 -0
  35. data/ext/libxml/ruby_xml_input_cbg.h +20 -0
  36. data/ext/libxml/ruby_xml_io.c +47 -0
  37. data/ext/libxml/ruby_xml_io.h +10 -0
  38. data/ext/libxml/ruby_xml_namespace.c +153 -0
  39. data/ext/libxml/ruby_xml_namespace.h +10 -0
  40. data/ext/libxml/ruby_xml_namespaces.c +293 -0
  41. data/ext/libxml/ruby_xml_namespaces.h +9 -0
  42. data/ext/libxml/ruby_xml_node.c +1402 -0
  43. data/ext/libxml/ruby_xml_node.h +13 -0
  44. data/ext/libxml/ruby_xml_parser.c +91 -0
  45. data/ext/libxml/ruby_xml_parser.h +12 -0
  46. data/ext/libxml/ruby_xml_parser_context.c +999 -0
  47. data/ext/libxml/ruby_xml_parser_context.h +10 -0
  48. data/ext/libxml/ruby_xml_parser_options.c +66 -0
  49. data/ext/libxml/ruby_xml_parser_options.h +12 -0
  50. data/ext/libxml/ruby_xml_reader.c +1239 -0
  51. data/ext/libxml/ruby_xml_reader.h +17 -0
  52. data/ext/libxml/ruby_xml_relaxng.c +110 -0
  53. data/ext/libxml/ruby_xml_relaxng.h +10 -0
  54. data/ext/libxml/ruby_xml_sax2_handler.c +326 -0
  55. data/ext/libxml/ruby_xml_sax2_handler.h +10 -0
  56. data/ext/libxml/ruby_xml_sax_parser.c +116 -0
  57. data/ext/libxml/ruby_xml_sax_parser.h +10 -0
  58. data/ext/libxml/ruby_xml_schema.c +278 -0
  59. data/ext/libxml/ruby_xml_schema.h +809 -0
  60. data/ext/libxml/ruby_xml_schema_attribute.c +109 -0
  61. data/ext/libxml/ruby_xml_schema_attribute.h +15 -0
  62. data/ext/libxml/ruby_xml_schema_element.c +95 -0
  63. data/ext/libxml/ruby_xml_schema_element.h +14 -0
  64. data/ext/libxml/ruby_xml_schema_facet.c +52 -0
  65. data/ext/libxml/ruby_xml_schema_facet.h +13 -0
  66. data/ext/libxml/ruby_xml_schema_type.c +232 -0
  67. data/ext/libxml/ruby_xml_schema_type.h +9 -0
  68. data/ext/libxml/ruby_xml_version.h +9 -0
  69. data/ext/libxml/ruby_xml_writer.c +1133 -0
  70. data/ext/libxml/ruby_xml_writer.h +10 -0
  71. data/ext/libxml/ruby_xml_xinclude.c +16 -0
  72. data/ext/libxml/ruby_xml_xinclude.h +11 -0
  73. data/ext/libxml/ruby_xml_xpath.c +194 -0
  74. data/ext/libxml/ruby_xml_xpath.h +13 -0
  75. data/ext/libxml/ruby_xml_xpath_context.c +360 -0
  76. data/ext/libxml/ruby_xml_xpath_context.h +9 -0
  77. data/ext/libxml/ruby_xml_xpath_expression.c +81 -0
  78. data/ext/libxml/ruby_xml_xpath_expression.h +10 -0
  79. data/ext/libxml/ruby_xml_xpath_object.c +338 -0
  80. data/ext/libxml/ruby_xml_xpath_object.h +17 -0
  81. data/ext/libxml/ruby_xml_xpointer.c +99 -0
  82. data/ext/libxml/ruby_xml_xpointer.h +11 -0
  83. data/ext/vc/libxml_ruby.sln +28 -0
  84. data/lib/3.1/libxml_ruby.so +0 -0
  85. data/lib/libxml/attr.rb +123 -0
  86. data/lib/libxml/attr_decl.rb +80 -0
  87. data/lib/libxml/attributes.rb +14 -0
  88. data/lib/libxml/document.rb +194 -0
  89. data/lib/libxml/error.rb +95 -0
  90. data/lib/libxml/hpricot.rb +78 -0
  91. data/lib/libxml/html_parser.rb +96 -0
  92. data/lib/libxml/namespace.rb +62 -0
  93. data/lib/libxml/namespaces.rb +38 -0
  94. data/lib/libxml/node.rb +323 -0
  95. data/lib/libxml/parser.rb +101 -0
  96. data/lib/libxml/sax_callbacks.rb +180 -0
  97. data/lib/libxml/sax_parser.rb +41 -0
  98. data/lib/libxml/schema/attribute.rb +19 -0
  99. data/lib/libxml/schema/element.rb +19 -0
  100. data/lib/libxml/schema/type.rb +21 -0
  101. data/lib/libxml/schema.rb +48 -0
  102. data/lib/libxml/tree.rb +29 -0
  103. data/lib/libxml-ruby.rb +30 -0
  104. data/lib/libxml.rb +5 -0
  105. data/lib/xml/libxml.rb +10 -0
  106. data/lib/xml.rb +14 -0
  107. data/libxml-ruby.gemspec +48 -0
  108. data/script/benchmark/depixelate +634 -0
  109. data/script/benchmark/hamlet.xml +9055 -0
  110. data/script/benchmark/parsecount +170 -0
  111. data/script/benchmark/sock_entries.xml +507 -0
  112. data/script/benchmark/throughput +41 -0
  113. data/script/test +6 -0
  114. data/setup.rb +1584 -0
  115. data/test/c14n/given/doc.dtd +1 -0
  116. data/test/c14n/given/example-1.xml +14 -0
  117. data/test/c14n/given/example-2.xml +11 -0
  118. data/test/c14n/given/example-3.xml +18 -0
  119. data/test/c14n/given/example-4.xml +9 -0
  120. data/test/c14n/given/example-5.xml +12 -0
  121. data/test/c14n/given/example-6.xml +2 -0
  122. data/test/c14n/given/example-7.xml +11 -0
  123. data/test/c14n/given/example-8.xml +11 -0
  124. data/test/c14n/given/example-8.xpath +10 -0
  125. data/test/c14n/given/world.txt +1 -0
  126. data/test/c14n/result/1-1-without-comments/example-1 +4 -0
  127. data/test/c14n/result/1-1-without-comments/example-2 +11 -0
  128. data/test/c14n/result/1-1-without-comments/example-3 +14 -0
  129. data/test/c14n/result/1-1-without-comments/example-4 +9 -0
  130. data/test/c14n/result/1-1-without-comments/example-5 +3 -0
  131. data/test/c14n/result/1-1-without-comments/example-6 +1 -0
  132. data/test/c14n/result/1-1-without-comments/example-7 +1 -0
  133. data/test/c14n/result/1-1-without-comments/example-8 +1 -0
  134. data/test/c14n/result/with-comments/example-1 +6 -0
  135. data/test/c14n/result/with-comments/example-2 +11 -0
  136. data/test/c14n/result/with-comments/example-3 +14 -0
  137. data/test/c14n/result/with-comments/example-4 +9 -0
  138. data/test/c14n/result/with-comments/example-5 +4 -0
  139. data/test/c14n/result/with-comments/example-6 +1 -0
  140. data/test/c14n/result/with-comments/example-7 +1 -0
  141. data/test/c14n/result/without-comments/example-1 +4 -0
  142. data/test/c14n/result/without-comments/example-2 +11 -0
  143. data/test/c14n/result/without-comments/example-3 +14 -0
  144. data/test/c14n/result/without-comments/example-4 +9 -0
  145. data/test/c14n/result/without-comments/example-5 +3 -0
  146. data/test/c14n/result/without-comments/example-6 +1 -0
  147. data/test/c14n/result/without-comments/example-7 +1 -0
  148. data/test/model/atom.xml +13 -0
  149. data/test/model/bands.iso-8859-1.xml +5 -0
  150. data/test/model/bands.utf-8.xml +5 -0
  151. data/test/model/bands.xml +5 -0
  152. data/test/model/books.xml +154 -0
  153. data/test/model/cwm_1_0.xml +11336 -0
  154. data/test/model/merge_bug_data.xml +58 -0
  155. data/test/model/ruby-lang.html +238 -0
  156. data/test/model/rubynet.xml +79 -0
  157. data/test/model/rubynet_project +1 -0
  158. data/test/model/shiporder.rnc +28 -0
  159. data/test/model/shiporder.rng +86 -0
  160. data/test/model/shiporder.xml +23 -0
  161. data/test/model/shiporder.xsd +40 -0
  162. data/test/model/soap.xml +27 -0
  163. data/test/model/xinclude.xml +5 -0
  164. data/test/test_attr.rb +181 -0
  165. data/test/test_attr_decl.rb +132 -0
  166. data/test/test_attributes.rb +136 -0
  167. data/test/test_canonicalize.rb +120 -0
  168. data/test/test_deprecated_require.rb +12 -0
  169. data/test/test_document.rb +132 -0
  170. data/test/test_document_write.rb +146 -0
  171. data/test/test_dtd.rb +129 -0
  172. data/test/test_encoding.rb +129 -0
  173. data/test/test_encoding_sax.rb +115 -0
  174. data/test/test_error.rb +178 -0
  175. data/test/test_helper.rb +9 -0
  176. data/test/test_html_parser.rb +162 -0
  177. data/test/test_html_parser_context.rb +23 -0
  178. data/test/test_namespace.rb +60 -0
  179. data/test/test_namespaces.rb +200 -0
  180. data/test/test_node.rb +237 -0
  181. data/test/test_node_cdata.rb +50 -0
  182. data/test/test_node_comment.rb +32 -0
  183. data/test/test_node_copy.rb +40 -0
  184. data/test/test_node_edit.rb +158 -0
  185. data/test/test_node_pi.rb +37 -0
  186. data/test/test_node_text.rb +69 -0
  187. data/test/test_node_write.rb +97 -0
  188. data/test/test_node_xlink.rb +28 -0
  189. data/test/test_parser.rb +324 -0
  190. data/test/test_parser_context.rb +198 -0
  191. data/test/test_properties.rb +38 -0
  192. data/test/test_reader.rb +364 -0
  193. data/test/test_relaxng.rb +53 -0
  194. data/test/test_sax_parser.rb +326 -0
  195. data/test/test_schema.rb +168 -0
  196. data/test/test_suite.rb +48 -0
  197. data/test/test_traversal.rb +152 -0
  198. data/test/test_writer.rb +468 -0
  199. data/test/test_xinclude.rb +20 -0
  200. data/test/test_xml.rb +263 -0
  201. data/test/test_xpath.rb +244 -0
  202. data/test/test_xpath_context.rb +88 -0
  203. data/test/test_xpath_expression.rb +37 -0
  204. data/test/test_xpointer.rb +72 -0
  205. metadata +325 -0
@@ -0,0 +1,999 @@
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #include "ruby_libxml.h"
4
+ #include "ruby_xml_parser_context.h"
5
+
6
+ VALUE cXMLParserContext;
7
+ static ID IO_ATTR;
8
+
9
+ /*
10
+ * Document-class: LibXML::XML::Parser::Context
11
+ *
12
+ * The XML::Parser::Context class provides in-depth control over how
13
+ * a document is parsed.
14
+ */
15
+
16
+ static void rxml_parser_context_free(xmlParserCtxtPtr ctxt)
17
+ {
18
+ xmlFreeParserCtxt(ctxt);
19
+ }
20
+
21
+ static VALUE rxml_parser_context_wrap(xmlParserCtxtPtr ctxt)
22
+ {
23
+ return Data_Wrap_Struct(cXMLParserContext, NULL, rxml_parser_context_free, ctxt);
24
+ }
25
+
26
+
27
+ static VALUE rxml_parser_context_alloc(VALUE klass)
28
+ {
29
+ xmlParserCtxtPtr ctxt = xmlNewParserCtxt();
30
+ return Data_Wrap_Struct(klass, NULL, rxml_parser_context_free, ctxt);
31
+ }
32
+
33
+ /* call-seq:
34
+ * XML::Parser::Context.document(document) -> XML::Parser::Context
35
+ *
36
+ * Creates a new parser context based on the specified document.
37
+ *
38
+ * Parameters:
39
+ *
40
+ * document - An XML::Document instance.
41
+ */
42
+ static VALUE rxml_parser_context_document(VALUE klass, VALUE document)
43
+ {
44
+ xmlParserCtxtPtr ctxt;
45
+ xmlDocPtr xdoc;
46
+ xmlChar *buffer;
47
+ int length;
48
+
49
+ if (rb_obj_is_kind_of(document, cXMLDocument) == Qfalse)
50
+ rb_raise(rb_eTypeError, "Must pass an LibXML::XML::Document object");
51
+
52
+ Data_Get_Struct(document, xmlDoc, xdoc);
53
+ xmlDocDumpFormatMemoryEnc(xdoc, &buffer, &length, (const char*)xdoc->encoding, 0);
54
+
55
+ ctxt = xmlCreateDocParserCtxt(buffer);
56
+
57
+ if (!ctxt)
58
+ rxml_raise(&xmlLastError);
59
+
60
+ /* This is annoying, but xmlInitParserCtxt (called indirectly above) and
61
+ xmlCtxtUseOptionsInternal (called below) initialize slightly different
62
+ context options, in particular XML_PARSE_NODICT which xmlInitParserCtxt
63
+ sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */
64
+ xmlCtxtUseOptions(ctxt, rxml_libxml_default_options());
65
+
66
+ return rxml_parser_context_wrap(ctxt);
67
+ }
68
+
69
+ /* call-seq:
70
+ * XML::Parser::Context.file(file) -> XML::Parser::Context
71
+ *
72
+ * Creates a new parser context based on the specified file or uri.
73
+ *
74
+ * Parameters:
75
+ *
76
+ * file - A filename or uri.
77
+ */
78
+ static VALUE rxml_parser_context_file(VALUE klass, VALUE file)
79
+ {
80
+ xmlParserCtxtPtr ctxt = xmlCreateURLParserCtxt(StringValuePtr(file), 0);
81
+
82
+ if (!ctxt)
83
+ rxml_raise(&xmlLastError);
84
+
85
+ /* This is annoying, but xmlInitParserCtxt (called indirectly above) and
86
+ xmlCtxtUseOptionsInternal (called below) initialize slightly different
87
+ context options, in particular XML_PARSE_NODICT which xmlInitParserCtxt
88
+ sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */
89
+ xmlCtxtUseOptions(ctxt, rxml_libxml_default_options());
90
+
91
+ return rxml_parser_context_wrap(ctxt);
92
+ }
93
+
94
+ /* call-seq:
95
+ * XML::Parser::Context.string(string) -> XML::Parser::Context
96
+ *
97
+ * Creates a new parser context based on the specified string.
98
+ *
99
+ * Parameters:
100
+ *
101
+ * string - A string that contains the data to parse.
102
+ */
103
+ static VALUE rxml_parser_context_string(VALUE klass, VALUE string)
104
+ {
105
+ xmlParserCtxtPtr ctxt;
106
+ Check_Type(string, T_STRING);
107
+
108
+ if (RSTRING_LEN(string) == 0)
109
+ rb_raise(rb_eArgError, "Must specify a string with one or more characters");
110
+
111
+ ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(string), (int)RSTRING_LEN(string));
112
+
113
+ if (!ctxt)
114
+ rxml_raise(&xmlLastError);
115
+
116
+ /* This is annoying, but xmlInitParserCtxt (called indirectly above) and
117
+ xmlCtxtUseOptionsInternal (called below) initialize slightly different
118
+ context options, in particular XML_PARSE_NODICT which xmlInitParserCtxt
119
+ sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */
120
+ xmlCtxtUseOptions(ctxt, rxml_libxml_default_options());
121
+
122
+ return rxml_parser_context_wrap(ctxt);
123
+ }
124
+
125
+ /* call-seq:
126
+ * XML::Parser::Context.io(io) -> XML::Parser::Context
127
+ *
128
+ * Creates a new parser context based on the specified io object.
129
+ *
130
+ * Parameters:
131
+ *
132
+ * io - A ruby IO object.
133
+ */
134
+ static VALUE rxml_parser_context_io(VALUE klass, VALUE io)
135
+ {
136
+ VALUE result;
137
+ xmlParserCtxtPtr ctxt;
138
+ xmlParserInputBufferPtr input;
139
+ xmlParserInputPtr stream;
140
+
141
+ if (NIL_P(io))
142
+ rb_raise(rb_eTypeError, "Must pass in an IO object");
143
+
144
+ input = xmlParserInputBufferCreateIO((xmlInputReadCallback) rxml_read_callback, NULL,
145
+ (void*)io, XML_CHAR_ENCODING_NONE);
146
+
147
+ ctxt = xmlNewParserCtxt();
148
+
149
+ if (!ctxt)
150
+ {
151
+ xmlFreeParserInputBuffer(input);
152
+ rxml_raise(&xmlLastError);
153
+ }
154
+
155
+ /* This is annoying, but xmlInitParserCtxt (called indirectly above) and
156
+ xmlCtxtUseOptionsInternal (called below) initialize slightly different
157
+ context options, in particular XML_PARSE_NODICT which xmlInitParserCtxt
158
+ sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */
159
+ xmlCtxtUseOptions(ctxt, rxml_libxml_default_options());
160
+
161
+ stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE);
162
+
163
+ if (!stream)
164
+ {
165
+ xmlFreeParserInputBuffer(input);
166
+ xmlFreeParserCtxt(ctxt);
167
+ rxml_raise(&xmlLastError);
168
+ }
169
+ inputPush(ctxt, stream);
170
+ result = rxml_parser_context_wrap(ctxt);
171
+
172
+ /* Attach io object to parser so it won't get freed.*/
173
+ rb_ivar_set(result, IO_ATTR, io);
174
+
175
+ return result;
176
+ }
177
+
178
+ /*
179
+ * call-seq:
180
+ * context.base_uri -> "http:://libxml.org"
181
+ *
182
+ * Obtain the base url for this parser context.
183
+ */
184
+ static VALUE rxml_parser_context_base_uri_get(VALUE self)
185
+ {
186
+ xmlParserCtxtPtr ctxt;
187
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
188
+
189
+ if (ctxt->input && ctxt->input->filename)
190
+ return rxml_new_cstr((const xmlChar*)ctxt->input->filename, ctxt->encoding);
191
+ else
192
+ return Qnil;
193
+ }
194
+
195
+ /*
196
+ * call-seq:
197
+ * context.base_uri = "http:://libxml.org"
198
+ *
199
+ * Sets the base url for this parser context.
200
+ */
201
+ static VALUE rxml_parser_context_base_uri_set(VALUE self, VALUE url)
202
+ {
203
+ xmlParserCtxtPtr ctxt;
204
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
205
+
206
+ Check_Type(url, T_STRING);
207
+
208
+ if (ctxt->input && !ctxt->input->filename)
209
+ {
210
+ const char* xurl = StringValuePtr(url);
211
+ ctxt->input->filename = (const char*)xmlStrdup((const xmlChar*)xurl);
212
+ }
213
+ return self;
214
+ }
215
+
216
+ /*
217
+ * call-seq:
218
+ * context.close -> nil
219
+ *
220
+ * Closes the underlying input streams. This is useful when parsing a large amount of
221
+ * files and you want to close the files without relying on Ruby's garbage collector
222
+ * to run.
223
+ */
224
+ static VALUE rxml_parser_context_close(VALUE self)
225
+ {
226
+ xmlParserCtxtPtr ctxt;
227
+ xmlParserInputPtr xinput;
228
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
229
+
230
+ while ((xinput = inputPop(ctxt)) != NULL)
231
+ {
232
+ xmlFreeInputStream(xinput);
233
+ }
234
+ return Qnil;
235
+ }
236
+
237
+ /*
238
+ * call-seq:
239
+ * context.data_directory -> "dir"
240
+ *
241
+ * Obtain the data directory associated with this context.
242
+ */
243
+ static VALUE rxml_parser_context_data_directory_get(VALUE self)
244
+ {
245
+ xmlParserCtxtPtr ctxt;
246
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
247
+
248
+ if (ctxt->directory == NULL)
249
+ return (Qnil);
250
+ else
251
+ return (rxml_new_cstr((const xmlChar*)ctxt->directory, ctxt->encoding));
252
+ }
253
+
254
+ /*
255
+ * call-seq:
256
+ * context.depth -> num
257
+ *
258
+ * Obtain the depth of this context.
259
+ */
260
+ static VALUE rxml_parser_context_depth_get(VALUE self)
261
+ {
262
+ xmlParserCtxtPtr ctxt;
263
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
264
+
265
+ return (INT2NUM(ctxt->depth));
266
+ }
267
+
268
+ /*
269
+ * call-seq:
270
+ * context.disable_cdata? -> (true|false)
271
+ *
272
+ * Determine whether CDATA nodes will be created in this context.
273
+ */
274
+ static VALUE rxml_parser_context_disable_cdata_q(VALUE self)
275
+ {
276
+ xmlParserCtxtPtr ctxt;
277
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
278
+
279
+ /* LibXML controls this internally with the default SAX handler. */
280
+ if (ctxt->sax && ctxt->sax->cdataBlock)
281
+ return (Qfalse);
282
+ else
283
+ return (Qtrue);
284
+ }
285
+
286
+ /*
287
+ * call-seq:
288
+ * context.disable_cdata = (true|false)
289
+ *
290
+ * Control whether CDATA nodes will be created in this context.
291
+ */
292
+ static VALUE rxml_parser_context_disable_cdata_set(VALUE self, VALUE value)
293
+ {
294
+ xmlParserCtxtPtr ctxt;
295
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
296
+
297
+ if (ctxt->sax == NULL)
298
+ rb_raise(rb_eRuntimeError, "Sax handler is not yet set");
299
+
300
+ /* LibXML controls this internally with the default SAX handler. */
301
+ if (value)
302
+ ctxt->sax->cdataBlock = NULL;
303
+ else
304
+ ctxt->sax->cdataBlock = xmlDefaultSAXHandler.cdataBlock;
305
+
306
+ return value;
307
+ }
308
+
309
+ /*
310
+ * call-seq:
311
+ * context.disable_sax? -> (true|false)
312
+ *
313
+ * Determine whether SAX-based processing is disabled
314
+ * in this context.
315
+ */
316
+ static VALUE rxml_parser_context_disable_sax_q(VALUE self)
317
+ {
318
+ xmlParserCtxtPtr ctxt;
319
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
320
+
321
+ if (ctxt->disableSAX)
322
+ return (Qtrue);
323
+ else
324
+ return (Qfalse);
325
+ }
326
+
327
+ /*
328
+ * call-seq:
329
+ * context.docbook? -> (true|false)
330
+ *
331
+ * Determine whether this is a docbook context.
332
+ */
333
+ static VALUE rxml_parser_context_docbook_q(VALUE self)
334
+ {
335
+ xmlParserCtxtPtr ctxt;
336
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
337
+
338
+ if (ctxt->html == 2) // TODO check this
339
+ return (Qtrue);
340
+ else
341
+ return (Qfalse);
342
+ }
343
+
344
+ /*
345
+ * call-seq:
346
+ * context.encoding -> XML::Encoding::UTF_8
347
+ *
348
+ * Obtain the character encoding identifier used in
349
+ * this context.
350
+ */
351
+ static VALUE rxml_parser_context_encoding_get(VALUE self)
352
+ {
353
+ xmlParserCtxtPtr ctxt;
354
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
355
+ return INT2NUM(xmlParseCharEncoding((const char*)ctxt->encoding));
356
+ }
357
+
358
+ /*
359
+ * call-seq:
360
+ * context.encoding = XML::Encoding::UTF_8
361
+ *
362
+ * Sets the character encoding for this context.
363
+ */
364
+ static VALUE rxml_parser_context_encoding_set(VALUE self, VALUE encoding)
365
+ {
366
+ xmlParserCtxtPtr ctxt;
367
+ int result;
368
+ const char* xencoding = xmlGetCharEncodingName((xmlCharEncoding)NUM2INT(encoding));
369
+ xmlCharEncodingHandlerPtr hdlr = xmlFindCharEncodingHandler(xencoding);
370
+
371
+ if (!hdlr)
372
+ rb_raise(rb_eArgError, "Unknown encoding: %i", NUM2INT(encoding));
373
+
374
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
375
+ result = xmlSwitchToEncoding(ctxt, hdlr);
376
+
377
+ if (result != 0)
378
+ rxml_raise(&xmlLastError);
379
+
380
+ if (ctxt->encoding != NULL)
381
+ xmlFree((xmlChar *) ctxt->encoding);
382
+
383
+ ctxt->encoding = xmlStrdup((const xmlChar *) xencoding);
384
+ return self;
385
+ }
386
+
387
+ /*
388
+ * call-seq:
389
+ * context.errno -> num
390
+ *
391
+ * Obtain the last-error number in this context.
392
+ */
393
+ static VALUE rxml_parser_context_errno_get(VALUE self)
394
+ {
395
+ xmlParserCtxtPtr ctxt;
396
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
397
+
398
+ return (INT2NUM(ctxt->errNo));
399
+ }
400
+
401
+ /*
402
+ * call-seq:
403
+ * context.html? -> (true|false)
404
+ *
405
+ * Determine whether this is an html context.
406
+ */
407
+ static VALUE rxml_parser_context_html_q(VALUE self)
408
+ {
409
+ xmlParserCtxtPtr ctxt;
410
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
411
+
412
+ if (ctxt->html == 1)
413
+ return (Qtrue);
414
+ else
415
+ return (Qfalse);
416
+ }
417
+
418
+ /*
419
+ * call-seq:
420
+ * context.max_num_streams -> num
421
+ *
422
+ * Obtain the limit on the number of IO streams opened in
423
+ * this context.
424
+ */
425
+ static VALUE rxml_parser_context_io_max_num_streams_get(VALUE self)
426
+ {
427
+ // TODO alias to max_streams and dep this?
428
+ xmlParserCtxtPtr ctxt;
429
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
430
+
431
+ return (INT2NUM(ctxt->inputMax));
432
+ }
433
+
434
+ /*
435
+ * call-seq:
436
+ * context.num_streams -> "dir"
437
+ *
438
+ * Obtain the actual number of IO streams in this
439
+ * context.
440
+ */
441
+ static VALUE rxml_parser_context_io_num_streams_get(VALUE self)
442
+ {
443
+ xmlParserCtxtPtr ctxt;
444
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
445
+
446
+ return (INT2NUM(ctxt->inputNr));
447
+ }
448
+
449
+ /*
450
+ * call-seq:
451
+ * context.keep_blanks? -> (true|false)
452
+ *
453
+ * Determine whether parsers in this context retain
454
+ * whitespace.
455
+ */
456
+ static VALUE rxml_parser_context_keep_blanks_q(VALUE self)
457
+ {
458
+ xmlParserCtxtPtr ctxt;
459
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
460
+
461
+ if (ctxt->keepBlanks)
462
+ return (Qtrue);
463
+ else
464
+ return (Qfalse);
465
+ }
466
+
467
+ /*
468
+ * call-seq:
469
+ * context.name_depth -> num
470
+ *
471
+ * Obtain the name depth for this context.
472
+ */
473
+ static VALUE rxml_parser_context_name_depth_get(VALUE self)
474
+ {
475
+ xmlParserCtxtPtr ctxt;
476
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
477
+
478
+ return (INT2NUM(ctxt->nameNr));
479
+ }
480
+
481
+ /*
482
+ * call-seq:
483
+ * context.name_depth_max -> num
484
+ *
485
+ * Obtain the maximum name depth for this context.
486
+ */
487
+ static VALUE rxml_parser_context_name_depth_max_get(VALUE self)
488
+ {
489
+ xmlParserCtxtPtr ctxt;
490
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
491
+
492
+ return (INT2NUM(ctxt->nameMax));
493
+ }
494
+
495
+ /*
496
+ * call-seq:
497
+ * context.name_node -> "name"
498
+ *
499
+ * Obtain the name node for this context.
500
+ */
501
+ static VALUE rxml_parser_context_name_node_get(VALUE self)
502
+ {
503
+ xmlParserCtxtPtr ctxt;
504
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
505
+
506
+ if (ctxt->name == NULL)
507
+ return (Qnil);
508
+ else
509
+ return (rxml_new_cstr( ctxt->name, ctxt->encoding));
510
+ }
511
+
512
+ /*
513
+ * call-seq:
514
+ * context.name_tab -> ["name", ..., "name"]
515
+ *
516
+ * Obtain the name table for this context.
517
+ */
518
+ static VALUE rxml_parser_context_name_tab_get(VALUE self)
519
+ {
520
+ int i;
521
+ xmlParserCtxtPtr ctxt;
522
+ VALUE tab_ary;
523
+
524
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
525
+
526
+ if (ctxt->nameTab == NULL)
527
+ return (Qnil);
528
+
529
+ tab_ary = rb_ary_new();
530
+
531
+ for (i = (ctxt->nameNr - 1); i >= 0; i--)
532
+ {
533
+ if (ctxt->nameTab[i] == NULL)
534
+ continue;
535
+ else
536
+ rb_ary_push(tab_ary, rxml_new_cstr( ctxt->nameTab[i], ctxt->encoding));
537
+ }
538
+
539
+ return (tab_ary);
540
+ }
541
+
542
+ /*
543
+ * call-seq:
544
+ * context.node_depth -> num
545
+ *
546
+ * Obtain the node depth for this context.
547
+ */
548
+ static VALUE rxml_parser_context_node_depth_get(VALUE self)
549
+ {
550
+ xmlParserCtxtPtr ctxt;
551
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
552
+
553
+ return (INT2NUM(ctxt->nodeNr));
554
+ }
555
+
556
+ /*
557
+ * call-seq:
558
+ * context.node -> node
559
+ *
560
+ * Obtain the root node of this context.
561
+ */
562
+ static VALUE rxml_parser_context_node_get(VALUE self)
563
+ {
564
+ xmlParserCtxtPtr ctxt;
565
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
566
+
567
+ if (ctxt->node == NULL)
568
+ return (Qnil);
569
+ else
570
+ return (rxml_node_wrap(ctxt->node));
571
+ }
572
+
573
+ /*
574
+ * call-seq:
575
+ * context.node_depth_max -> num
576
+ *
577
+ * Obtain the maximum node depth for this context.
578
+ */
579
+ static VALUE rxml_parser_context_node_depth_max_get(VALUE self)
580
+ {
581
+ xmlParserCtxtPtr ctxt;
582
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
583
+
584
+ return (INT2NUM(ctxt->nodeMax));
585
+ }
586
+
587
+ /*
588
+ * call-seq:
589
+ * context.num_chars -> num
590
+ *
591
+ * Obtain the number of characters in this context.
592
+ */
593
+ static VALUE rxml_parser_context_num_chars_get(VALUE self)
594
+ {
595
+ xmlParserCtxtPtr ctxt;
596
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
597
+
598
+ return (LONG2NUM(ctxt->nbChars));
599
+ }
600
+
601
+
602
+ /*
603
+ * call-seq:
604
+ * context.options > XML::Parser::Options::NOENT
605
+ *
606
+ * Returns the parser options for this context. Multiple
607
+ * options can be combined by using Bitwise OR (|).
608
+ */
609
+ static VALUE rxml_parser_context_options_get(VALUE self)
610
+ {
611
+ xmlParserCtxtPtr ctxt;
612
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
613
+
614
+ return INT2NUM(ctxt->options);
615
+ }
616
+
617
+ /*
618
+ * call-seq:
619
+ * context.options = XML::Parser::Options::NOENT |
620
+ XML::Parser::Options::NOCDATA
621
+ *
622
+ * Provides control over the execution of a parser. Valid values
623
+ * are the constants defined on XML::Parser::Options. Multiple
624
+ * options can be combined by using Bitwise OR (|).
625
+ */
626
+ static VALUE rxml_parser_context_options_set(VALUE self, VALUE options)
627
+ {
628
+ xmlParserCtxtPtr ctxt;
629
+ Check_Type(options, T_FIXNUM);
630
+
631
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
632
+ xmlCtxtUseOptions(ctxt, NUM2INT(options));
633
+
634
+ return self;
635
+ }
636
+
637
+ /*
638
+ * call-seq:
639
+ * context.recovery? -> (true|false)
640
+ *
641
+ * Determine whether recovery mode is enabled in this
642
+ * context.
643
+ */
644
+ static VALUE rxml_parser_context_recovery_q(VALUE self)
645
+ {
646
+ xmlParserCtxtPtr ctxt;
647
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
648
+
649
+ if (ctxt->recovery)
650
+ return (Qtrue);
651
+ else
652
+ return (Qfalse);
653
+ }
654
+
655
+ /*
656
+ * call-seq:
657
+ * context.recovery = true|false
658
+ *
659
+ * Control whether recovery mode is enabled in this
660
+ * context.
661
+ */
662
+ static VALUE rxml_parser_context_recovery_set(VALUE self, VALUE value)
663
+ {
664
+ xmlParserCtxtPtr ctxt;
665
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
666
+
667
+ if (value == Qfalse)
668
+ {
669
+ ctxt->recovery = 0;
670
+ return (Qfalse);
671
+ }
672
+ else
673
+ {
674
+ ctxt->recovery = 1;
675
+ return (Qtrue);
676
+ }
677
+ }
678
+
679
+ /*
680
+ * call-seq:
681
+ * context.replace_entities? -> (true|false)
682
+ *
683
+ * Determine whether external entity replacement is enabled in this
684
+ * context.
685
+ */
686
+ static VALUE rxml_parser_context_replace_entities_q(VALUE self)
687
+ {
688
+ xmlParserCtxtPtr ctxt;
689
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
690
+
691
+ if (ctxt->replaceEntities)
692
+ return (Qtrue);
693
+ else
694
+ return (Qfalse);
695
+ }
696
+
697
+ /*
698
+ * call-seq:
699
+ * context.replace_entities = true|false
700
+ *
701
+ * Control whether external entity replacement is enabled in this
702
+ * context.
703
+ */
704
+ static VALUE rxml_parser_context_replace_entities_set(VALUE self, VALUE value)
705
+ {
706
+ xmlParserCtxtPtr ctxt;
707
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
708
+
709
+ if (value == Qfalse)
710
+ {
711
+ ctxt->replaceEntities = 0;
712
+ return (Qfalse);
713
+ }
714
+ else
715
+ {
716
+ ctxt->replaceEntities = 1;
717
+ return (Qtrue);
718
+ }
719
+ }
720
+
721
+ /*
722
+ * call-seq:
723
+ * context.space_depth -> num
724
+ *
725
+ * Obtain the space depth for this context.
726
+ */
727
+ static VALUE rxml_parser_context_space_depth_get(VALUE self)
728
+ {
729
+ xmlParserCtxtPtr ctxt;
730
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
731
+
732
+ return (INT2NUM(ctxt->spaceNr));
733
+ }
734
+
735
+ /*
736
+ * call-seq:
737
+ * context.space_depth -> num
738
+ *
739
+ * Obtain the maximum space depth for this context.
740
+ */
741
+ static VALUE rxml_parser_context_space_depth_max_get(VALUE self)
742
+ {
743
+ xmlParserCtxtPtr ctxt;
744
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
745
+
746
+ return (INT2NUM(ctxt->spaceMax));
747
+ }
748
+
749
+ /*
750
+ * call-seq:
751
+ * context.subset_external? -> (true|false)
752
+ *
753
+ * Determine whether this context is a subset of an
754
+ * external context.
755
+ */
756
+ static VALUE rxml_parser_context_subset_external_q(VALUE self)
757
+ {
758
+ xmlParserCtxtPtr ctxt;
759
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
760
+
761
+ if (ctxt->inSubset == 2)
762
+ return (Qtrue);
763
+ else
764
+ return (Qfalse);
765
+ }
766
+
767
+ /*
768
+ * call-seq:
769
+ * context.subset_internal? -> (true|false)
770
+ *
771
+ * Determine whether this context is a subset of an
772
+ * internal context.
773
+ */
774
+ static VALUE rxml_parser_context_subset_internal_q(VALUE self)
775
+ {
776
+ xmlParserCtxtPtr ctxt;
777
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
778
+
779
+ if (ctxt->inSubset == 1)
780
+ return (Qtrue);
781
+ else
782
+ return (Qfalse);
783
+ }
784
+
785
+ /*
786
+ * call-seq:
787
+ * context.subset_internal_name -> "name"
788
+ *
789
+ * Obtain this context's subset name (valid only if
790
+ * either of subset_external? or subset_internal?
791
+ * is true).
792
+ */
793
+ static VALUE rxml_parser_context_subset_name_get(VALUE self)
794
+ {
795
+ xmlParserCtxtPtr ctxt;
796
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
797
+
798
+ if (ctxt->intSubName == NULL)
799
+ return (Qnil);
800
+ else
801
+ return (rxml_new_cstr(ctxt->intSubName, ctxt->encoding));
802
+ }
803
+
804
+ /*
805
+ * call-seq:
806
+ * context.subset_external_uri -> "uri"
807
+ *
808
+ * Obtain this context's external subset URI. (valid only if
809
+ * either of subset_external? or subset_internal?
810
+ * is true).
811
+ */
812
+ static VALUE rxml_parser_context_subset_external_uri_get(VALUE self)
813
+ {
814
+ xmlParserCtxtPtr ctxt;
815
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
816
+
817
+ if (ctxt->extSubURI == NULL)
818
+ return (Qnil);
819
+ else
820
+ return (rxml_new_cstr( ctxt->extSubURI, ctxt->encoding));
821
+ }
822
+
823
+ /*
824
+ * call-seq:
825
+ * context.subset_external_system_id -> "system_id"
826
+ *
827
+ * Obtain this context's external subset system identifier.
828
+ * (valid only if either of subset_external? or subset_internal?
829
+ * is true).
830
+ */
831
+ static VALUE rxml_parser_context_subset_external_system_id_get(VALUE self)
832
+ {
833
+ xmlParserCtxtPtr ctxt;
834
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
835
+
836
+ if (ctxt->extSubSystem == NULL)
837
+ return (Qnil);
838
+ else
839
+ return (rxml_new_cstr( ctxt->extSubSystem, ctxt->encoding));
840
+ }
841
+
842
+ /*
843
+ * call-seq:
844
+ * context.standalone? -> (true|false)
845
+ *
846
+ * Determine whether this is a standalone context.
847
+ */
848
+ static VALUE rxml_parser_context_standalone_q(VALUE self)
849
+ {
850
+ xmlParserCtxtPtr ctxt;
851
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
852
+
853
+ if (ctxt->standalone)
854
+ return (Qtrue);
855
+ else
856
+ return (Qfalse);
857
+ }
858
+
859
+ /*
860
+ * call-seq:
861
+ * context.stats? -> (true|false)
862
+ *
863
+ * Determine whether this context maintains statistics.
864
+ */
865
+ static VALUE rxml_parser_context_stats_q(VALUE self)
866
+ {
867
+ xmlParserCtxtPtr ctxt;
868
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
869
+
870
+ if (ctxt->record_info)
871
+ return (Qtrue);
872
+ else
873
+ return (Qfalse);
874
+ }
875
+
876
+ /*
877
+ * call-seq:
878
+ * context.valid? -> (true|false)
879
+ *
880
+ * Determine whether this context is valid.
881
+ */
882
+ static VALUE rxml_parser_context_valid_q(VALUE self)
883
+ {
884
+ xmlParserCtxtPtr ctxt;
885
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
886
+
887
+ if (ctxt->valid)
888
+ return (Qtrue);
889
+ else
890
+ return (Qfalse);
891
+ }
892
+
893
+ /*
894
+ * call-seq:
895
+ * context.validate? -> (true|false)
896
+ *
897
+ * Determine whether validation is enabled in this context.
898
+ */
899
+ static VALUE rxml_parser_context_validate_q(VALUE self)
900
+ {
901
+ xmlParserCtxtPtr ctxt;
902
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
903
+
904
+ if (ctxt->validate)
905
+ return (Qtrue);
906
+ else
907
+ return (Qfalse);
908
+ }
909
+
910
+ /*
911
+ * call-seq:
912
+ * context.version -> "version"
913
+ *
914
+ * Obtain this context's version identifier.
915
+ */
916
+ static VALUE rxml_parser_context_version_get(VALUE self)
917
+ {
918
+ xmlParserCtxtPtr ctxt;
919
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
920
+
921
+ if (ctxt->version == NULL)
922
+ return (Qnil);
923
+ else
924
+ return (rxml_new_cstr( ctxt->version, ctxt->encoding));
925
+ }
926
+
927
+ /*
928
+ * call-seq:
929
+ * context.well_formed? -> (true|false)
930
+ *
931
+ * Determine whether this context contains well-formed XML.
932
+ */
933
+ static VALUE rxml_parser_context_well_formed_q(VALUE self)
934
+ {
935
+ xmlParserCtxtPtr ctxt;
936
+ Data_Get_Struct(self, xmlParserCtxt, ctxt);
937
+
938
+ if (ctxt->wellFormed)
939
+ return (Qtrue);
940
+ else
941
+ return (Qfalse);
942
+ }
943
+
944
+ void rxml_init_parser_context(void)
945
+ {
946
+ IO_ATTR = ID2SYM(rb_intern("@io"));
947
+
948
+ cXMLParserContext = rb_define_class_under(cXMLParser, "Context", rb_cObject);
949
+ rb_define_alloc_func(cXMLParserContext, rxml_parser_context_alloc);
950
+
951
+ rb_define_singleton_method(cXMLParserContext, "document", rxml_parser_context_document, 1);
952
+ rb_define_singleton_method(cXMLParserContext, "file", rxml_parser_context_file, 1);
953
+ rb_define_singleton_method(cXMLParserContext, "io", rxml_parser_context_io, 1);
954
+ rb_define_singleton_method(cXMLParserContext, "string", rxml_parser_context_string, 1);
955
+
956
+ rb_define_method(cXMLParserContext, "base_uri", rxml_parser_context_base_uri_get, 0);
957
+ rb_define_method(cXMLParserContext, "base_uri=", rxml_parser_context_base_uri_set, 1);
958
+ rb_define_method(cXMLParserContext, "close", rxml_parser_context_close, 0);
959
+ rb_define_method(cXMLParserContext, "data_directory", rxml_parser_context_data_directory_get, 0);
960
+ rb_define_method(cXMLParserContext, "depth", rxml_parser_context_depth_get, 0);
961
+ rb_define_method(cXMLParserContext, "disable_cdata?", rxml_parser_context_disable_cdata_q, 0);
962
+ rb_define_method(cXMLParserContext, "disable_cdata=", rxml_parser_context_disable_cdata_set, 1);
963
+ rb_define_method(cXMLParserContext, "disable_sax?", rxml_parser_context_disable_sax_q, 0);
964
+ rb_define_method(cXMLParserContext, "docbook?", rxml_parser_context_docbook_q, 0);
965
+ rb_define_method(cXMLParserContext, "encoding", rxml_parser_context_encoding_get, 0);
966
+ rb_define_method(cXMLParserContext, "encoding=", rxml_parser_context_encoding_set, 1);
967
+ rb_define_method(cXMLParserContext, "errno", rxml_parser_context_errno_get, 0);
968
+ rb_define_method(cXMLParserContext, "html?", rxml_parser_context_html_q, 0);
969
+ rb_define_method(cXMLParserContext, "io_max_num_streams", rxml_parser_context_io_max_num_streams_get, 0);
970
+ rb_define_method(cXMLParserContext, "io_num_streams", rxml_parser_context_io_num_streams_get, 0);
971
+ rb_define_method(cXMLParserContext, "keep_blanks?", rxml_parser_context_keep_blanks_q, 0);
972
+ rb_define_method(cXMLParserContext, "name_node", rxml_parser_context_name_node_get, 0);
973
+ rb_define_method(cXMLParserContext, "name_depth", rxml_parser_context_name_depth_get, 0);
974
+ rb_define_method(cXMLParserContext, "name_depth_max", rxml_parser_context_name_depth_max_get, 0);
975
+ rb_define_method(cXMLParserContext, "name_tab", rxml_parser_context_name_tab_get, 0);
976
+ rb_define_method(cXMLParserContext, "node", rxml_parser_context_node_get, 0);
977
+ rb_define_method(cXMLParserContext, "node_depth", rxml_parser_context_node_depth_get, 0);
978
+ rb_define_method(cXMLParserContext, "node_depth_max", rxml_parser_context_node_depth_max_get, 0);
979
+ rb_define_method(cXMLParserContext, "num_chars", rxml_parser_context_num_chars_get, 0);
980
+ rb_define_method(cXMLParserContext, "options", rxml_parser_context_options_get, 0);
981
+ rb_define_method(cXMLParserContext, "options=", rxml_parser_context_options_set, 1);
982
+ rb_define_method(cXMLParserContext, "recovery?", rxml_parser_context_recovery_q, 0);
983
+ rb_define_method(cXMLParserContext, "recovery=", rxml_parser_context_recovery_set, 1);
984
+ rb_define_method(cXMLParserContext, "replace_entities?", rxml_parser_context_replace_entities_q, 0);
985
+ rb_define_method(cXMLParserContext, "replace_entities=", rxml_parser_context_replace_entities_set, 1);
986
+ rb_define_method(cXMLParserContext, "space_depth", rxml_parser_context_space_depth_get, 0);
987
+ rb_define_method(cXMLParserContext, "space_depth_max", rxml_parser_context_space_depth_max_get, 0);
988
+ rb_define_method(cXMLParserContext, "subset_external?", rxml_parser_context_subset_external_q, 0);
989
+ rb_define_method(cXMLParserContext, "subset_external_system_id", rxml_parser_context_subset_external_system_id_get, 0);
990
+ rb_define_method(cXMLParserContext, "subset_external_uri", rxml_parser_context_subset_external_uri_get, 0);
991
+ rb_define_method(cXMLParserContext, "subset_internal?", rxml_parser_context_subset_internal_q, 0);
992
+ rb_define_method(cXMLParserContext, "subset_internal_name", rxml_parser_context_subset_name_get, 0);
993
+ rb_define_method(cXMLParserContext, "stats?", rxml_parser_context_stats_q, 0);
994
+ rb_define_method(cXMLParserContext, "standalone?", rxml_parser_context_standalone_q, 0);
995
+ rb_define_method(cXMLParserContext, "valid", rxml_parser_context_valid_q, 0);
996
+ rb_define_method(cXMLParserContext, "validate?", rxml_parser_context_validate_q, 0);
997
+ rb_define_method(cXMLParserContext, "version", rxml_parser_context_version_get, 0);
998
+ rb_define_method(cXMLParserContext, "well_formed?", rxml_parser_context_well_formed_q, 0);
999
+ }