libxml-ruby 0.8.3-x86-mswin32-60 → 0.9.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +18 -0
- data/RAKEFILE +15 -39
- data/README +48 -47
- data/ext/libxml/libxml.c +847 -22
- data/ext/libxml/ruby_libxml.h +71 -95
- data/ext/libxml/ruby_xml_attr.c +500 -500
- data/ext/libxml/ruby_xml_attributes.c +1 -1
- data/ext/libxml/ruby_xml_document.c +1144 -1135
- data/ext/libxml/ruby_xml_document.h +4 -11
- data/ext/libxml/ruby_xml_dtd.c +27 -0
- data/ext/libxml/ruby_xml_encoding.c +164 -0
- data/ext/libxml/ruby_xml_encoding.h +13 -0
- data/ext/libxml/ruby_xml_error.c +941 -0
- data/ext/libxml/ruby_xml_error.h +13 -0
- data/ext/libxml/ruby_xml_html_parser.c +71 -387
- data/ext/libxml/ruby_xml_html_parser.h +1 -17
- data/ext/libxml/ruby_xml_input.c +179 -0
- data/ext/libxml/ruby_xml_input.h +18 -0
- data/ext/libxml/ruby_xml_input_cbg.c +17 -3
- data/ext/libxml/ruby_xml_node.c +1566 -1582
- data/ext/libxml/ruby_xml_node.h +1 -4
- data/ext/libxml/ruby_xml_ns.c +14 -3
- data/ext/libxml/ruby_xml_parser.c +164 -1398
- data/ext/libxml/ruby_xml_parser.h +5 -17
- data/ext/libxml/ruby_xml_parser_context.c +131 -169
- data/ext/libxml/ruby_xml_parser_context.h +2 -9
- data/ext/libxml/ruby_xml_reader.c +910 -945
- data/ext/libxml/ruby_xml_relaxng.c +32 -3
- data/ext/libxml/ruby_xml_sax_parser.c +106 -364
- data/ext/libxml/ruby_xml_sax_parser.h +1 -37
- data/ext/libxml/ruby_xml_schema.c +174 -145
- data/ext/libxml/ruby_xml_xinclude.c +9 -5
- data/ext/libxml/ruby_xml_xpath.c +25 -6
- data/ext/libxml/ruby_xml_xpath.h +1 -2
- data/ext/libxml/ruby_xml_xpath_context.c +17 -19
- data/ext/libxml/ruby_xml_xpath_object.c +60 -56
- data/ext/libxml/ruby_xml_xpointer.c +11 -5
- data/ext/libxml/sax_parser_callbacks.inc +42 -37
- data/ext/libxml/version.h +3 -3
- data/ext/mingw/Rakefile +20 -27
- data/ext/mingw/build.rake +41 -0
- data/{lib → ext/mingw}/libiconv-2.dll +0 -0
- data/ext/mingw/libxml2-2.dll +0 -0
- data/ext/mingw/libxml_ruby.dll.a +0 -0
- data/ext/mingw/libxml_ruby.so +0 -0
- data/ext/vc/libxml_ruby.vcproj +23 -15
- data/lib/libxml.rb +8 -2
- data/lib/libxml/document.rb +16 -4
- data/lib/libxml/error.rb +84 -0
- data/lib/libxml/hpricot.rb +76 -0
- data/lib/libxml/html_parser.rb +61 -0
- data/lib/libxml/node.rb +36 -25
- data/lib/libxml/parser.rb +312 -33
- data/lib/libxml/parser_context.rb +17 -0
- data/lib/libxml/properties.rb +15 -2
- data/lib/libxml/reader.rb +15 -0
- data/lib/libxml/sax_callbacks.rb +179 -0
- data/lib/libxml/sax_parser.rb +42 -0
- data/lib/libxml/tree.rb +1 -2
- data/lib/libxml/xpath_object.rb +12 -0
- data/test/model/atom.xml +4 -0
- data/test/tc_attributes.rb +43 -19
- data/test/tc_document.rb +1 -1
- data/test/tc_document_write.rb +15 -8
- data/test/tc_dtd.rb +36 -20
- data/test/tc_encoding.rb +13 -0
- data/test/tc_error.rb +136 -0
- data/test/tc_node.rb +2 -3
- data/test/tc_node_copy.rb +1 -1
- data/test/tc_node_edit.rb +6 -0
- data/test/tc_ns.rb +18 -0
- data/test/tc_parser.rb +113 -228
- data/test/tc_parser_context.rb +1 -2
- data/test/tc_reader.rb +24 -14
- data/test/tc_relaxng.rb +18 -6
- data/test/tc_sax_parser.rb +48 -13
- data/test/tc_schema.rb +20 -8
- data/test/tc_well_formed.rb +2 -1
- data/test/tc_xml.rb +212 -0
- data/test/tc_xpath.rb +60 -46
- data/test/tc_xpointer.rb +7 -11
- data/test/test_suite.rb +4 -3
- metadata +32 -115
- data/doc/rdoc/classes/LibXML.html +0 -241
- data/doc/rdoc/classes/LibXML/XML.html +0 -185
- data/doc/rdoc/classes/LibXML/XML/Attr.html +0 -1010
- data/doc/rdoc/classes/LibXML/XML/Attributes.html +0 -526
- data/doc/rdoc/classes/LibXML/XML/Document.html +0 -1489
- data/doc/rdoc/classes/LibXML/XML/Dtd.html +0 -213
- data/doc/rdoc/classes/LibXML/XML/Error.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/HTMLParser.html +0 -348
- data/doc/rdoc/classes/LibXML/XML/InputCallbacks.html +0 -160
- data/doc/rdoc/classes/LibXML/XML/NS.html +0 -381
- data/doc/rdoc/classes/LibXML/XML/Node.html +0 -3396
- data/doc/rdoc/classes/LibXML/XML/Node/FailedModify.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Node/Set.html +0 -440
- data/doc/rdoc/classes/LibXML/XML/Node/SetNamespace.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Node/UnknownType.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Parser.html +0 -2239
- data/doc/rdoc/classes/LibXML/XML/Parser/Context.html +0 -1255
- data/doc/rdoc/classes/LibXML/XML/Parser/ParseError.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Reader.html +0 -2264
- data/doc/rdoc/classes/LibXML/XML/RelaxNG.html +0 -237
- data/doc/rdoc/classes/LibXML/XML/SaxParser.html +0 -415
- data/doc/rdoc/classes/LibXML/XML/Schema.html +0 -308
- data/doc/rdoc/classes/LibXML/XML/State.html +0 -124
- data/doc/rdoc/classes/LibXML/XML/Tree.html +0 -111
- data/doc/rdoc/classes/LibXML/XML/XInclude.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/XInclude/Error.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/XMLParserOptions.html +0 -198
- data/doc/rdoc/classes/LibXML/XML/XPath.html +0 -184
- data/doc/rdoc/classes/LibXML/XML/XPath/Context.html +0 -404
- data/doc/rdoc/classes/LibXML/XML/XPath/InvalidPath.html +0 -172
- data/doc/rdoc/classes/LibXML/XML/XPath/Object.html +0 -627
- data/doc/rdoc/classes/LibXML/XML/XPointer.html +0 -170
- data/doc/rdoc/classes/LibXML/XML/XPointer/Context.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/XPointer/Context/InvalidPath.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/XPointer/InvalidExpression.html +0 -124
- data/doc/rdoc/classes/singleton.html +0 -114
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGES.html +0 -442
- data/doc/rdoc/files/LICENSE.html +0 -133
- data/doc/rdoc/files/README.html +0 -388
- data/doc/rdoc/files/VERSION.html +0 -107
- data/doc/rdoc/files/ext/libxml/cbg_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/libxml_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_attr_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_attributes_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_document_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_dtd_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_input_cbg_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_node_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_node_set_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_ns_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_context_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_reader_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_relaxng_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_sax_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_schema_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_state_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xinclude_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_context_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_object_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_context_c.html +0 -101
- data/doc/rdoc/files/lib/libxml/attr_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/attributes_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/document_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/node_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/node_set_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/parser_options_rb.html +0 -107
- data/doc/rdoc/files/lib/libxml/parser_rb.html +0 -101
- data/doc/rdoc/files/lib/libxml/properties_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/tree_rb.html +0 -107
- data/doc/rdoc/files/lib/libxml_rb.html +0 -124
- data/doc/rdoc/files/lib/xml/libxml_rb.html +0 -124
- data/doc/rdoc/files/lib/xml_rb.html +0 -134
- data/doc/rdoc/fr_class_index.html +0 -62
- data/doc/rdoc/fr_file_index.html +0 -66
- data/doc/rdoc/fr_method_index.html +0 -392
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/ext/libxml/ruby_xml_node_set.c +0 -172
- data/ext/libxml/ruby_xml_node_set.h +0 -20
- data/ext/libxml/ruby_xml_xpointer_context.c +0 -22
- data/ext/libxml/ruby_xml_xpointer_context.h +0 -18
- data/lib/libxml/node_set.rb +0 -27
- data/lib/libxml2-2.dll +0 -0
- data/lib/libxml_ruby.dll.a +0 -0
- data/lib/libxml_ruby.so +0 -0
- data/test/tc_node_set.rb +0 -24
- data/test/tc_node_set2.rb +0 -37
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: ruby_xml_parser.h
|
1
|
+
/* $Id: ruby_xml_parser.h 550 2008-11-17 23:26:53Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
@@ -7,25 +7,13 @@
|
|
7
7
|
|
8
8
|
#define MAX_LIBXML_FEATURES_LEN 50
|
9
9
|
|
10
|
-
|
10
|
+
|
11
11
|
extern VALUE cXMLParser;
|
12
|
-
extern VALUE eXMLParserParseError;
|
13
12
|
|
14
|
-
|
15
|
-
VALUE ctxt;
|
16
|
-
int parsed;
|
17
|
-
void *data;
|
18
|
-
int data_type;
|
19
|
-
} ruby_xml_parser;
|
13
|
+
void ruby_init_parser();
|
20
14
|
|
21
|
-
VALUE ruby_xml_parser_default_load_external_dtd_set(VALUE class, VALUE bool);
|
22
15
|
VALUE ruby_xml_parser_default_substitute_entities_set(VALUE class, VALUE bool);
|
23
|
-
VALUE
|
24
|
-
|
25
|
-
VALUE ruby_xml_parser_filename_set(VALUE self, VALUE filename);
|
26
|
-
VALUE ruby_xml_parser_new(VALUE class);
|
27
|
-
VALUE ruby_xml_parser_parse(VALUE self);
|
28
|
-
VALUE ruby_xml_parser_str_get(VALUE self);
|
29
|
-
VALUE ruby_xml_parser_str_set(VALUE self, VALUE str);
|
16
|
+
VALUE ruby_xml_parser_default_load_external_dtd_set(VALUE class, VALUE bool);
|
17
|
+
|
30
18
|
|
31
19
|
#endif
|
@@ -1,20 +1,30 @@
|
|
1
|
-
/* $Id: ruby_xml_parser_context.c
|
1
|
+
/* $Id: ruby_xml_parser_context.c 566 2008-11-18 06:53:36Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
5
5
|
#include "ruby_libxml.h"
|
6
6
|
#include "ruby_xml_parser_context.h"
|
7
7
|
|
8
|
-
|
8
|
+
VALUE cXMLParserContext;
|
9
|
+
|
10
|
+
/*
|
11
|
+
* Document-class: LibXML::XML::Parser::Context
|
9
12
|
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
* *) validity context
|
13
|
-
* *) record_info or stats class/structure
|
14
|
-
* *) xmlParserNodeInfoSeq
|
15
|
-
* *) xmlParserInputState
|
13
|
+
* The XML::Parser::Context class provides in-depth control over how
|
14
|
+
* a document is parsed.
|
16
15
|
*/
|
17
|
-
|
16
|
+
|
17
|
+
|
18
|
+
void
|
19
|
+
ruby_xml_parser_context_free(xmlParserCtxtPtr ctxt) {
|
20
|
+
if (ctxt != NULL)
|
21
|
+
xmlFreeParserCtxt(ctxt);
|
22
|
+
}
|
23
|
+
|
24
|
+
VALUE
|
25
|
+
ruby_xml_parser_context_wrap(xmlParserCtxtPtr ctxt) {
|
26
|
+
return Data_Wrap_Struct(cXMLParserContext, NULL, ruby_xml_parser_context_free, ctxt);
|
27
|
+
}
|
18
28
|
|
19
29
|
/*
|
20
30
|
* call-seq:
|
@@ -24,13 +34,13 @@ VALUE cXMLParserContext;
|
|
24
34
|
*/
|
25
35
|
VALUE
|
26
36
|
ruby_xml_parser_context_data_directory_get(VALUE self) {
|
27
|
-
|
28
|
-
Data_Get_Struct(self,
|
37
|
+
xmlParserCtxtPtr ctxt;
|
38
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
29
39
|
|
30
|
-
if (
|
40
|
+
if (ctxt->directory == NULL)
|
31
41
|
return(Qnil);
|
32
42
|
else
|
33
|
-
return(rb_str_new2(
|
43
|
+
return(rb_str_new2(ctxt->directory));
|
34
44
|
}
|
35
45
|
|
36
46
|
|
@@ -42,10 +52,10 @@ ruby_xml_parser_context_data_directory_get(VALUE self) {
|
|
42
52
|
*/
|
43
53
|
VALUE
|
44
54
|
ruby_xml_parser_context_depth_get(VALUE self) {
|
45
|
-
|
46
|
-
Data_Get_Struct(self,
|
55
|
+
xmlParserCtxtPtr ctxt;
|
56
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
47
57
|
|
48
|
-
return(INT2NUM(
|
58
|
+
return(INT2NUM(ctxt->depth));
|
49
59
|
}
|
50
60
|
|
51
61
|
|
@@ -58,10 +68,10 @@ ruby_xml_parser_context_depth_get(VALUE self) {
|
|
58
68
|
*/
|
59
69
|
VALUE
|
60
70
|
ruby_xml_parser_context_disable_sax_q(VALUE self) {
|
61
|
-
|
62
|
-
Data_Get_Struct(self,
|
71
|
+
xmlParserCtxtPtr ctxt;
|
72
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
63
73
|
|
64
|
-
if (
|
74
|
+
if (ctxt->disableSAX)
|
65
75
|
return(Qtrue);
|
66
76
|
else
|
67
77
|
return(Qfalse);
|
@@ -77,10 +87,10 @@ ruby_xml_parser_context_disable_sax_q(VALUE self) {
|
|
77
87
|
*/
|
78
88
|
VALUE
|
79
89
|
ruby_xml_parser_context_docbook_q(VALUE self) {
|
80
|
-
|
81
|
-
Data_Get_Struct(self,
|
90
|
+
xmlParserCtxtPtr ctxt;
|
91
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
82
92
|
|
83
|
-
if (
|
93
|
+
if (ctxt->html == 2) // TODO check this
|
84
94
|
return(Qtrue);
|
85
95
|
else
|
86
96
|
return(Qfalse);
|
@@ -96,13 +106,13 @@ ruby_xml_parser_context_docbook_q(VALUE self) {
|
|
96
106
|
*/
|
97
107
|
VALUE
|
98
108
|
ruby_xml_parser_context_encoding_get(VALUE self) {
|
99
|
-
|
100
|
-
Data_Get_Struct(self,
|
109
|
+
xmlParserCtxtPtr ctxt;
|
110
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
101
111
|
|
102
|
-
if (
|
112
|
+
if (ctxt->encoding == NULL)
|
103
113
|
return(Qnil);
|
104
114
|
else
|
105
|
-
return(rb_str_new2((const char*)
|
115
|
+
return(rb_str_new2((const char*)ctxt->encoding));
|
106
116
|
}
|
107
117
|
|
108
118
|
|
@@ -114,23 +124,13 @@ ruby_xml_parser_context_encoding_get(VALUE self) {
|
|
114
124
|
*/
|
115
125
|
VALUE
|
116
126
|
ruby_xml_parser_context_errno_get(VALUE self) {
|
117
|
-
|
118
|
-
Data_Get_Struct(self,
|
127
|
+
xmlParserCtxtPtr ctxt;
|
128
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
119
129
|
|
120
|
-
return(INT2NUM(
|
130
|
+
return(INT2NUM(ctxt->errNo));
|
121
131
|
}
|
122
132
|
|
123
133
|
|
124
|
-
void
|
125
|
-
ruby_xml_parser_context_free(ruby_xml_parser_context *rxpc) {
|
126
|
-
if (rxpc->ctxt != NULL) {
|
127
|
-
xmlFreeParserCtxt(rxpc->ctxt);
|
128
|
-
rxpc->ctxt = NULL;
|
129
|
-
}
|
130
|
-
|
131
|
-
ruby_xfree(rxpc);
|
132
|
-
}
|
133
|
-
|
134
134
|
|
135
135
|
/*
|
136
136
|
* call-seq:
|
@@ -140,10 +140,10 @@ ruby_xml_parser_context_free(ruby_xml_parser_context *rxpc) {
|
|
140
140
|
*/
|
141
141
|
VALUE
|
142
142
|
ruby_xml_parser_context_html_q(VALUE self) {
|
143
|
-
|
144
|
-
Data_Get_Struct(self,
|
143
|
+
xmlParserCtxtPtr ctxt;
|
144
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
145
145
|
|
146
|
-
if (
|
146
|
+
if (ctxt->html == 1)
|
147
147
|
return(Qtrue);
|
148
148
|
else
|
149
149
|
return(Qfalse);
|
@@ -160,10 +160,10 @@ ruby_xml_parser_context_html_q(VALUE self) {
|
|
160
160
|
VALUE
|
161
161
|
ruby_xml_parser_context_io_max_num_streams_get(VALUE self) {
|
162
162
|
// TODO alias to max_streams and dep this?
|
163
|
-
|
164
|
-
Data_Get_Struct(self,
|
163
|
+
xmlParserCtxtPtr ctxt;
|
164
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
165
165
|
|
166
|
-
return(INT2NUM(
|
166
|
+
return(INT2NUM(ctxt->inputMax));
|
167
167
|
}
|
168
168
|
|
169
169
|
|
@@ -176,10 +176,10 @@ ruby_xml_parser_context_io_max_num_streams_get(VALUE self) {
|
|
176
176
|
*/
|
177
177
|
VALUE
|
178
178
|
ruby_xml_parser_context_io_num_streams_get(VALUE self) {
|
179
|
-
|
180
|
-
Data_Get_Struct(self,
|
179
|
+
xmlParserCtxtPtr ctxt;
|
180
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
181
181
|
|
182
|
-
return(INT2NUM(
|
182
|
+
return(INT2NUM(ctxt->inputNr));
|
183
183
|
}
|
184
184
|
|
185
185
|
|
@@ -192,10 +192,10 @@ ruby_xml_parser_context_io_num_streams_get(VALUE self) {
|
|
192
192
|
*/
|
193
193
|
VALUE
|
194
194
|
ruby_xml_parser_context_keep_blanks_q(VALUE self) {
|
195
|
-
|
196
|
-
Data_Get_Struct(self,
|
195
|
+
xmlParserCtxtPtr ctxt;
|
196
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
197
197
|
|
198
|
-
if (
|
198
|
+
if (ctxt->keepBlanks)
|
199
199
|
return(Qtrue);
|
200
200
|
else
|
201
201
|
return(Qfalse);
|
@@ -210,10 +210,10 @@ ruby_xml_parser_context_keep_blanks_q(VALUE self) {
|
|
210
210
|
*/
|
211
211
|
VALUE
|
212
212
|
ruby_xml_parser_context_name_depth_get(VALUE self) {
|
213
|
-
|
214
|
-
Data_Get_Struct(self,
|
213
|
+
xmlParserCtxtPtr ctxt;
|
214
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
215
215
|
|
216
|
-
return(INT2NUM(
|
216
|
+
return(INT2NUM(ctxt->nameNr));
|
217
217
|
}
|
218
218
|
|
219
219
|
|
@@ -225,10 +225,10 @@ ruby_xml_parser_context_name_depth_get(VALUE self) {
|
|
225
225
|
*/
|
226
226
|
VALUE
|
227
227
|
ruby_xml_parser_context_name_depth_max_get(VALUE self) {
|
228
|
-
|
229
|
-
Data_Get_Struct(self,
|
228
|
+
xmlParserCtxtPtr ctxt;
|
229
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
230
230
|
|
231
|
-
return(INT2NUM(
|
231
|
+
return(INT2NUM(ctxt->nameMax));
|
232
232
|
}
|
233
233
|
|
234
234
|
|
@@ -240,13 +240,13 @@ ruby_xml_parser_context_name_depth_max_get(VALUE self) {
|
|
240
240
|
*/
|
241
241
|
VALUE
|
242
242
|
ruby_xml_parser_context_name_node_get(VALUE self) {
|
243
|
-
|
244
|
-
Data_Get_Struct(self,
|
243
|
+
xmlParserCtxtPtr ctxt;
|
244
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
245
245
|
|
246
|
-
if (
|
246
|
+
if (ctxt->name == NULL)
|
247
247
|
return(Qnil);
|
248
248
|
else
|
249
|
-
return(rb_str_new2((const char*)
|
249
|
+
return(rb_str_new2((const char*)ctxt->name));
|
250
250
|
}
|
251
251
|
|
252
252
|
|
@@ -259,21 +259,21 @@ ruby_xml_parser_context_name_node_get(VALUE self) {
|
|
259
259
|
VALUE
|
260
260
|
ruby_xml_parser_context_name_tab_get(VALUE self) {
|
261
261
|
int i;
|
262
|
-
|
262
|
+
xmlParserCtxtPtr ctxt;
|
263
263
|
VALUE tab_ary;
|
264
264
|
|
265
|
-
Data_Get_Struct(self,
|
265
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
266
266
|
|
267
|
-
if (
|
267
|
+
if (ctxt->nameTab == NULL)
|
268
268
|
return(Qnil);
|
269
269
|
|
270
270
|
tab_ary = rb_ary_new();
|
271
271
|
|
272
|
-
for (i = (
|
273
|
-
if (
|
272
|
+
for (i = (ctxt->nameNr - 1); i >= 0; i--) {
|
273
|
+
if (ctxt->nameTab[i] == NULL)
|
274
274
|
continue;
|
275
275
|
else
|
276
|
-
rb_ary_push(tab_ary, rb_str_new2((const char*)
|
276
|
+
rb_ary_push(tab_ary, rb_str_new2((const char*)ctxt->nameTab[i]));
|
277
277
|
}
|
278
278
|
|
279
279
|
return(tab_ary);
|
@@ -288,10 +288,10 @@ ruby_xml_parser_context_name_tab_get(VALUE self) {
|
|
288
288
|
*/
|
289
289
|
VALUE
|
290
290
|
ruby_xml_parser_context_node_depth_get(VALUE self) {
|
291
|
-
|
292
|
-
Data_Get_Struct(self,
|
291
|
+
xmlParserCtxtPtr ctxt;
|
292
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
293
293
|
|
294
|
-
return(INT2NUM(
|
294
|
+
return(INT2NUM(ctxt->nodeNr));
|
295
295
|
}
|
296
296
|
|
297
297
|
|
@@ -303,14 +303,14 @@ ruby_xml_parser_context_node_depth_get(VALUE self) {
|
|
303
303
|
*/
|
304
304
|
VALUE
|
305
305
|
ruby_xml_parser_context_node_get(VALUE self) {
|
306
|
-
|
307
|
-
Data_Get_Struct(self,
|
306
|
+
xmlParserCtxtPtr ctxt;
|
307
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
308
308
|
|
309
|
-
if (
|
309
|
+
if (ctxt->node == NULL)
|
310
310
|
return(Qnil);
|
311
311
|
else
|
312
312
|
return(ruby_xml_node2_wrap(cXMLNode,
|
313
|
-
|
313
|
+
ctxt->node));
|
314
314
|
}
|
315
315
|
|
316
316
|
|
@@ -322,10 +322,10 @@ ruby_xml_parser_context_node_get(VALUE self) {
|
|
322
322
|
*/
|
323
323
|
VALUE
|
324
324
|
ruby_xml_parser_context_node_depth_max_get(VALUE self) {
|
325
|
-
|
326
|
-
Data_Get_Struct(self,
|
325
|
+
xmlParserCtxtPtr ctxt;
|
326
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
327
327
|
|
328
|
-
return(INT2NUM(
|
328
|
+
return(INT2NUM(ctxt->nodeMax));
|
329
329
|
}
|
330
330
|
|
331
331
|
|
@@ -337,39 +337,10 @@ ruby_xml_parser_context_node_depth_max_get(VALUE self) {
|
|
337
337
|
*/
|
338
338
|
VALUE
|
339
339
|
ruby_xml_parser_context_num_chars_get(VALUE self) {
|
340
|
-
|
341
|
-
Data_Get_Struct(self,
|
340
|
+
xmlParserCtxtPtr ctxt;
|
341
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
342
342
|
|
343
|
-
return(LONG2NUM(
|
344
|
-
}
|
345
|
-
|
346
|
-
|
347
|
-
VALUE
|
348
|
-
ruby_xml_parser_context_new() {
|
349
|
-
ruby_xml_parser_context *rxpc = ALLOC(ruby_xml_parser_context);
|
350
|
-
return Data_Wrap_Struct(cXMLParserContext,
|
351
|
-
NULL,
|
352
|
-
ruby_xml_parser_context_free,
|
353
|
-
rxpc);
|
354
|
-
}
|
355
|
-
|
356
|
-
|
357
|
-
VALUE
|
358
|
-
ruby_xml_parser_context_options_set(VALUE self, VALUE options) {
|
359
|
-
ruby_xml_parser_context *rxpc;
|
360
|
-
Data_Get_Struct(self, ruby_xml_parser_context, rxpc);
|
361
|
-
|
362
|
-
if (xmlCtxtUseOptions(rxpc->ctxt, NUM2INT(options)))
|
363
|
-
return Qfalse;
|
364
|
-
else
|
365
|
-
return Qtrue;
|
366
|
-
}
|
367
|
-
|
368
|
-
VALUE
|
369
|
-
ruby_xml_parser_context_options_get(VALUE self) {
|
370
|
-
ruby_xml_parser_context *rxpc;
|
371
|
-
Data_Get_Struct(self, ruby_xml_parser_context, rxpc);
|
372
|
-
return INT2NUM(rxpc->ctxt->options);
|
343
|
+
return(LONG2NUM(ctxt->nbChars));
|
373
344
|
}
|
374
345
|
|
375
346
|
/*
|
@@ -381,10 +352,10 @@ ruby_xml_parser_context_options_get(VALUE self) {
|
|
381
352
|
*/
|
382
353
|
VALUE
|
383
354
|
ruby_xml_parser_context_replace_entities_q(VALUE self) {
|
384
|
-
|
385
|
-
Data_Get_Struct(self,
|
355
|
+
xmlParserCtxtPtr ctxt;
|
356
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
386
357
|
|
387
|
-
if (
|
358
|
+
if (ctxt->replaceEntities)
|
388
359
|
return(Qtrue);
|
389
360
|
else
|
390
361
|
return(Qfalse);
|
@@ -400,14 +371,14 @@ ruby_xml_parser_context_replace_entities_q(VALUE self) {
|
|
400
371
|
*/
|
401
372
|
VALUE
|
402
373
|
ruby_xml_parser_context_replace_entities_set(VALUE self, VALUE bool) {
|
403
|
-
|
404
|
-
Data_Get_Struct(self,
|
374
|
+
xmlParserCtxtPtr ctxt;
|
375
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
405
376
|
|
406
377
|
if (TYPE(bool) == T_FALSE) {
|
407
|
-
|
378
|
+
ctxt->replaceEntities = 0;
|
408
379
|
return(Qfalse);
|
409
380
|
} else {
|
410
|
-
|
381
|
+
ctxt->replaceEntities = 1;
|
411
382
|
return(Qfalse);
|
412
383
|
}
|
413
384
|
}
|
@@ -420,10 +391,10 @@ ruby_xml_parser_context_replace_entities_set(VALUE self, VALUE bool) {
|
|
420
391
|
*/
|
421
392
|
VALUE
|
422
393
|
ruby_xml_parser_context_space_depth_get(VALUE self) {
|
423
|
-
|
424
|
-
Data_Get_Struct(self,
|
394
|
+
xmlParserCtxtPtr ctxt;
|
395
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
425
396
|
|
426
|
-
return(INT2NUM(
|
397
|
+
return(INT2NUM(ctxt->spaceNr));
|
427
398
|
}
|
428
399
|
|
429
400
|
|
@@ -435,10 +406,10 @@ ruby_xml_parser_context_space_depth_get(VALUE self) {
|
|
435
406
|
*/
|
436
407
|
VALUE
|
437
408
|
ruby_xml_parser_context_space_depth_max_get(VALUE self) {
|
438
|
-
|
439
|
-
Data_Get_Struct(self,
|
409
|
+
xmlParserCtxtPtr ctxt;
|
410
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
440
411
|
|
441
|
-
return(INT2NUM(
|
412
|
+
return(INT2NUM(ctxt->spaceMax));
|
442
413
|
}
|
443
414
|
|
444
415
|
|
@@ -451,10 +422,10 @@ ruby_xml_parser_context_space_depth_max_get(VALUE self) {
|
|
451
422
|
*/
|
452
423
|
VALUE
|
453
424
|
ruby_xml_parser_context_subset_external_q(VALUE self) {
|
454
|
-
|
455
|
-
Data_Get_Struct(self,
|
425
|
+
xmlParserCtxtPtr ctxt;
|
426
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
456
427
|
|
457
|
-
if (
|
428
|
+
if (ctxt->inSubset == 2)
|
458
429
|
return(Qtrue);
|
459
430
|
else
|
460
431
|
return(Qfalse);
|
@@ -470,10 +441,10 @@ ruby_xml_parser_context_subset_external_q(VALUE self) {
|
|
470
441
|
*/
|
471
442
|
VALUE
|
472
443
|
ruby_xml_parser_context_subset_internal_q(VALUE self) {
|
473
|
-
|
474
|
-
Data_Get_Struct(self,
|
444
|
+
xmlParserCtxtPtr ctxt;
|
445
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
475
446
|
|
476
|
-
if (
|
447
|
+
if (ctxt->inSubset == 1)
|
477
448
|
return(Qtrue);
|
478
449
|
else
|
479
450
|
return(Qfalse);
|
@@ -490,13 +461,13 @@ ruby_xml_parser_context_subset_internal_q(VALUE self) {
|
|
490
461
|
*/
|
491
462
|
VALUE
|
492
463
|
ruby_xml_parser_context_subset_name_get(VALUE self) {
|
493
|
-
|
494
|
-
Data_Get_Struct(self,
|
464
|
+
xmlParserCtxtPtr ctxt;
|
465
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
495
466
|
|
496
|
-
if (
|
467
|
+
if (ctxt->intSubName == NULL)
|
497
468
|
return(Qnil);
|
498
469
|
else
|
499
|
-
return(rb_str_new2((const char*)
|
470
|
+
return(rb_str_new2((const char*)ctxt->intSubName));
|
500
471
|
}
|
501
472
|
|
502
473
|
|
@@ -510,13 +481,13 @@ ruby_xml_parser_context_subset_name_get(VALUE self) {
|
|
510
481
|
*/
|
511
482
|
VALUE
|
512
483
|
ruby_xml_parser_context_subset_external_uri_get(VALUE self) {
|
513
|
-
|
514
|
-
Data_Get_Struct(self,
|
484
|
+
xmlParserCtxtPtr ctxt;
|
485
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
515
486
|
|
516
|
-
if (
|
487
|
+
if (ctxt->extSubURI == NULL)
|
517
488
|
return(Qnil);
|
518
489
|
else
|
519
|
-
return(rb_str_new2((const char*)
|
490
|
+
return(rb_str_new2((const char*)ctxt->extSubURI));
|
520
491
|
}
|
521
492
|
|
522
493
|
|
@@ -530,13 +501,13 @@ ruby_xml_parser_context_subset_external_uri_get(VALUE self) {
|
|
530
501
|
*/
|
531
502
|
VALUE
|
532
503
|
ruby_xml_parser_context_subset_external_system_id_get(VALUE self) {
|
533
|
-
|
534
|
-
Data_Get_Struct(self,
|
504
|
+
xmlParserCtxtPtr ctxt;
|
505
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
535
506
|
|
536
|
-
if (
|
507
|
+
if (ctxt->extSubSystem == NULL)
|
537
508
|
return(Qnil);
|
538
509
|
else
|
539
|
-
return(rb_str_new2((const char*)
|
510
|
+
return(rb_str_new2((const char*)ctxt->extSubSystem));
|
540
511
|
}
|
541
512
|
|
542
513
|
|
@@ -548,10 +519,10 @@ ruby_xml_parser_context_subset_external_system_id_get(VALUE self) {
|
|
548
519
|
*/
|
549
520
|
VALUE
|
550
521
|
ruby_xml_parser_context_standalone_q(VALUE self) {
|
551
|
-
|
552
|
-
Data_Get_Struct(self,
|
522
|
+
xmlParserCtxtPtr ctxt;
|
523
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
553
524
|
|
554
|
-
if (
|
525
|
+
if (ctxt->standalone)
|
555
526
|
return(Qtrue);
|
556
527
|
else
|
557
528
|
return(Qfalse);
|
@@ -566,10 +537,10 @@ ruby_xml_parser_context_standalone_q(VALUE self) {
|
|
566
537
|
*/
|
567
538
|
VALUE
|
568
539
|
ruby_xml_parser_context_stats_q(VALUE self) {
|
569
|
-
|
570
|
-
Data_Get_Struct(self,
|
540
|
+
xmlParserCtxtPtr ctxt;
|
541
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
571
542
|
|
572
|
-
if (
|
543
|
+
if (ctxt->record_info)
|
573
544
|
return(Qtrue);
|
574
545
|
else
|
575
546
|
return(Qfalse);
|
@@ -584,10 +555,10 @@ ruby_xml_parser_context_stats_q(VALUE self) {
|
|
584
555
|
*/
|
585
556
|
VALUE
|
586
557
|
ruby_xml_parser_context_valid_q(VALUE self) {
|
587
|
-
|
588
|
-
Data_Get_Struct(self,
|
558
|
+
xmlParserCtxtPtr ctxt;
|
559
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
589
560
|
|
590
|
-
if (
|
561
|
+
if (ctxt->valid)
|
591
562
|
return(Qtrue);
|
592
563
|
else
|
593
564
|
return(Qfalse);
|
@@ -602,10 +573,10 @@ ruby_xml_parser_context_valid_q(VALUE self) {
|
|
602
573
|
*/
|
603
574
|
VALUE
|
604
575
|
ruby_xml_parser_context_validate_q(VALUE self) {
|
605
|
-
|
606
|
-
Data_Get_Struct(self,
|
576
|
+
xmlParserCtxtPtr ctxt;
|
577
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
607
578
|
|
608
|
-
if (
|
579
|
+
if (ctxt->validate)
|
609
580
|
return(Qtrue);
|
610
581
|
else
|
611
582
|
return(Qfalse);
|
@@ -620,13 +591,13 @@ ruby_xml_parser_context_validate_q(VALUE self) {
|
|
620
591
|
*/
|
621
592
|
VALUE
|
622
593
|
ruby_xml_parser_context_version_get(VALUE self) {
|
623
|
-
|
624
|
-
Data_Get_Struct(self,
|
594
|
+
xmlParserCtxtPtr ctxt;
|
595
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
625
596
|
|
626
|
-
if (
|
597
|
+
if (ctxt->version == NULL)
|
627
598
|
return(Qnil);
|
628
599
|
else
|
629
|
-
return(rb_str_new2((const char*)
|
600
|
+
return(rb_str_new2((const char*)ctxt->version));
|
630
601
|
}
|
631
602
|
|
632
603
|
|
@@ -638,26 +609,19 @@ ruby_xml_parser_context_version_get(VALUE self) {
|
|
638
609
|
*/
|
639
610
|
VALUE
|
640
611
|
ruby_xml_parser_context_well_formed_q(VALUE self) {
|
641
|
-
|
642
|
-
Data_Get_Struct(self,
|
612
|
+
xmlParserCtxtPtr ctxt;
|
613
|
+
Data_Get_Struct(self, xmlParserCtxt, ctxt);
|
643
614
|
|
644
|
-
if (
|
615
|
+
if (ctxt->wellFormed)
|
645
616
|
return(Qtrue);
|
646
617
|
else
|
647
618
|
return(Qfalse);
|
648
619
|
}
|
649
620
|
|
650
|
-
|
651
|
-
// Rdoc needs to know
|
652
|
-
#ifdef RDOC_NEVER_DEFINED
|
653
|
-
mLibXML = rb_define_module("LibXML");
|
654
|
-
mXML = rb_define_module_under(mLibXML, "XML");
|
655
|
-
cXMLParser = rb_define_class_under(mXML, "Parser", rb_cObject);
|
656
|
-
#endif
|
657
|
-
|
658
621
|
void
|
659
622
|
ruby_init_xml_parser_context(void) {
|
660
623
|
cXMLParserContext = rb_define_class_under(cXMLParser, "Context", rb_cObject);
|
624
|
+
rb_undef_alloc_func(cXMLParserContext);
|
661
625
|
|
662
626
|
rb_define_method(cXMLParserContext, "data_directory", ruby_xml_parser_context_data_directory_get, 0);
|
663
627
|
rb_define_method(cXMLParserContext, "depth", ruby_xml_parser_context_depth_get, 0);
|
@@ -677,8 +641,6 @@ ruby_init_xml_parser_context(void) {
|
|
677
641
|
rb_define_method(cXMLParserContext, "node_depth", ruby_xml_parser_context_node_depth_get, 0);
|
678
642
|
rb_define_method(cXMLParserContext, "node_depth_max", ruby_xml_parser_context_node_depth_max_get, 0);
|
679
643
|
rb_define_method(cXMLParserContext, "num_chars", ruby_xml_parser_context_num_chars_get, 0);
|
680
|
-
rb_define_method(cXMLParserContext, "options", ruby_xml_parser_context_options_get, 0);
|
681
|
-
rb_define_method(cXMLParserContext, "options=", ruby_xml_parser_context_options_set, 1);
|
682
644
|
rb_define_method(cXMLParserContext, "replace_entities?", ruby_xml_parser_context_replace_entities_q, 0);
|
683
645
|
rb_define_method(cXMLParserContext, "replace_entities=", ruby_xml_parser_context_replace_entities_set, 1);
|
684
646
|
rb_define_method(cXMLParserContext, "space_depth", ruby_xml_parser_context_space_depth_get, 0);
|