libxml-ruby 1.1.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{CHANGES → HISTORY} +35 -0
- data/LICENSE +1 -0
- data/MANIFEST +165 -0
- data/{README → README.rdoc} +2 -2
- data/Rakefile +47 -147
- data/ext/libxml/libxml.c +17 -1
- data/ext/libxml/ruby_libxml.h +9 -1
- data/ext/libxml/ruby_xml_attr.c +3 -3
- data/ext/libxml/ruby_xml_attr_decl.c +32 -32
- data/ext/libxml/ruby_xml_attributes.c +1 -1
- data/ext/libxml/ruby_xml_cbg.c +1 -2
- data/ext/libxml/ruby_xml_document.c +26 -4
- data/ext/libxml/ruby_xml_dtd.c +3 -3
- data/ext/libxml/ruby_xml_encoding.c +92 -5
- data/ext/libxml/ruby_xml_encoding.h +4 -0
- data/ext/libxml/ruby_xml_namespace.c +2 -2
- data/ext/libxml/ruby_xml_node.c +14 -14
- data/ext/libxml/ruby_xml_parser_context.c +8 -8
- data/ext/libxml/ruby_xml_reader.c +98 -43
- data/ext/libxml/ruby_xml_sax2_handler.c +13 -1
- data/ext/libxml/ruby_xml_sax_parser.c +4 -5
- data/ext/libxml/ruby_xml_version.h +5 -5
- data/ext/libxml/ruby_xml_xpath_context.c +9 -6
- data/ext/libxml/ruby_xml_xpath_object.c +1 -1
- data/ext/vc/libxml_ruby.sln +4 -4
- data/lib/libxml.rb +29 -29
- data/lib/libxml/attr.rb +112 -110
- data/lib/libxml/attr_decl.rb +2 -0
- data/lib/libxml/attributes.rb +13 -11
- data/lib/libxml/document.rb +192 -190
- data/lib/libxml/error.rb +89 -87
- data/lib/libxml/hpricot.rb +77 -75
- data/lib/libxml/html_parser.rb +96 -94
- data/lib/libxml/namespace.rb +61 -59
- data/lib/libxml/namespaces.rb +37 -35
- data/lib/libxml/node.rb +398 -384
- data/lib/libxml/ns.rb +21 -19
- data/lib/libxml/parser.rb +366 -364
- data/lib/libxml/properties.rb +22 -20
- data/lib/libxml/reader.rb +2 -0
- data/lib/libxml/sax_callbacks.rb +179 -177
- data/lib/libxml/sax_parser.rb +57 -55
- data/lib/libxml/tree.rb +28 -26
- data/lib/libxml/xpath_object.rb +15 -13
- data/lib/xml.rb +16 -14
- data/lib/xml/libxml.rb +10 -8
- data/libxml-ruby.gemspec +50 -0
- data/script/benchmark/depixelate +634 -0
- data/script/benchmark/hamlet.xml +9055 -0
- data/script/benchmark/parsecount +170 -0
- data/script/benchmark/sock_entries.xml +507 -0
- data/script/benchmark/throughput +41 -0
- data/script/test +6 -0
- data/test/etc_doc_to_s.rb +21 -19
- data/test/ets_doc_file.rb +17 -15
- data/test/ets_doc_to_s.rb +23 -21
- data/test/ets_gpx.rb +28 -26
- data/test/ets_node_gc.rb +23 -21
- data/test/ets_tsr.rb +11 -9
- data/test/model/bands.iso-8859-1.xml +5 -0
- data/test/model/bands.utf-8.xml +5 -0
- data/test/rb-magic-comment.rb +33 -0
- data/test/tc_attr.rb +181 -170
- data/test/tc_attr_decl.rb +3 -1
- data/test/tc_attributes.rb +134 -132
- data/test/tc_deprecated_require.rb +13 -11
- data/test/tc_document.rb +119 -113
- data/test/tc_document_write.rb +186 -117
- data/test/tc_dtd.rb +125 -123
- data/test/tc_error.rb +3 -1
- data/test/tc_html_parser.rb +139 -137
- data/test/tc_namespace.rb +61 -58
- data/test/tc_namespaces.rb +176 -173
- data/test/tc_node.rb +257 -180
- data/test/tc_node_cdata.rb +51 -49
- data/test/tc_node_comment.rb +33 -30
- data/test/tc_node_copy.rb +42 -40
- data/test/tc_node_edit.rb +159 -157
- data/test/tc_node_text.rb +71 -69
- data/test/tc_node_write.rb +41 -16
- data/test/tc_node_xlink.rb +29 -26
- data/test/tc_parser.rb +335 -329
- data/test/tc_parser_context.rb +188 -185
- data/test/tc_properties.rb +39 -36
- data/test/tc_reader.rb +297 -283
- data/test/tc_relaxng.rb +54 -51
- data/test/tc_sax_parser.rb +275 -273
- data/test/tc_schema.rb +53 -51
- data/test/tc_traversal.rb +222 -220
- data/test/tc_xinclude.rb +21 -19
- data/test/tc_xml.rb +3 -1
- data/test/tc_xpath.rb +195 -193
- data/test/tc_xpath_context.rb +80 -78
- data/test/tc_xpath_expression.rb +38 -35
- data/test/tc_xpointer.rb +74 -72
- data/test/test_helper.rb +14 -0
- data/test/test_suite.rb +39 -33
- metadata +65 -105
- data/doc/css/normal.css +0 -182
- data/doc/img/raze-tiny.png +0 -0
- data/doc/img/red-cube.jpg +0 -0
- data/doc/img/xml-ruby.png +0 -0
- data/doc/index.xml +0 -43
- data/doc/install.xml +0 -77
- data/doc/layout.rhtml +0 -38
- data/doc/layout.xsl +0 -67
- data/doc/license.xml +0 -32
- data/doc/log/changelog.xml +0 -1324
- data/doc/log/changelog.xsl +0 -42
- data/ext/libxml/Makefile +0 -156
- data/ext/libxml/extconf.h +0 -5
- data/ext/libxml/libxml-ruby.so.a +0 -0
- data/ext/libxml/libxml.o +0 -0
- data/ext/libxml/libxml_ruby.so +0 -0
- data/ext/libxml/mkmf.log +0 -129
- data/ext/libxml/ruby_xml.o +0 -0
- data/ext/libxml/ruby_xml_attr.o +0 -0
- data/ext/libxml/ruby_xml_attr_decl.o +0 -0
- data/ext/libxml/ruby_xml_attributes.o +0 -0
- data/ext/libxml/ruby_xml_cbg.o +0 -0
- data/ext/libxml/ruby_xml_document.o +0 -0
- data/ext/libxml/ruby_xml_dtd.o +0 -0
- data/ext/libxml/ruby_xml_encoding.o +0 -0
- data/ext/libxml/ruby_xml_error.o +0 -0
- data/ext/libxml/ruby_xml_html_parser.o +0 -0
- data/ext/libxml/ruby_xml_html_parser_context.o +0 -0
- data/ext/libxml/ruby_xml_html_parser_options.o +0 -0
- data/ext/libxml/ruby_xml_input_cbg.o +0 -0
- data/ext/libxml/ruby_xml_io.o +0 -0
- data/ext/libxml/ruby_xml_namespace.o +0 -0
- data/ext/libxml/ruby_xml_namespaces.o +0 -0
- data/ext/libxml/ruby_xml_node.o +0 -0
- data/ext/libxml/ruby_xml_parser.o +0 -0
- data/ext/libxml/ruby_xml_parser_context.o +0 -0
- data/ext/libxml/ruby_xml_parser_options.o +0 -0
- data/ext/libxml/ruby_xml_reader.o +0 -0
- data/ext/libxml/ruby_xml_relaxng.o +0 -0
- data/ext/libxml/ruby_xml_sax2_handler.o +0 -0
- data/ext/libxml/ruby_xml_sax_parser.o +0 -0
- data/ext/libxml/ruby_xml_schema.o +0 -0
- data/ext/libxml/ruby_xml_xinclude.o +0 -0
- data/ext/libxml/ruby_xml_xpath.o +0 -0
- data/ext/libxml/ruby_xml_xpath_context.o +0 -0
- data/ext/libxml/ruby_xml_xpath_expression.o +0 -0
- data/ext/libxml/ruby_xml_xpath_object.o +0 -0
- data/ext/libxml/ruby_xml_xpointer.o +0 -0
data/lib/libxml/properties.rb
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
module LibXML
|
|
4
|
+
module XML
|
|
5
|
+
class Node
|
|
6
|
+
def property(name)
|
|
7
|
+
warn('Node#properties is deprecated. Use Node#[] instead.')
|
|
8
|
+
self[name]
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def properties
|
|
12
|
+
warn('Node#properties is deprecated. Use Node#attributes instead.')
|
|
13
|
+
self.attributes
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def properties?
|
|
17
|
+
warn('Node#properties? is deprecated. Use Node#attributes? instead.')
|
|
18
|
+
self.attributes?
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
21
23
|
end
|
data/lib/libxml/reader.rb
CHANGED
data/lib/libxml/sax_callbacks.rb
CHANGED
|
@@ -1,178 +1,180 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
STDOUT
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
STDOUT
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
STDOUT
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
STDOUT
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
STDOUT
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
module LibXML
|
|
4
|
+
module XML
|
|
5
|
+
class SaxParser
|
|
6
|
+
module Callbacks
|
|
7
|
+
# Called for a CDATA block event.
|
|
8
|
+
def on_cdata_block(cdata)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Called for a characters event.
|
|
12
|
+
def on_characters(chars)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Called for a comment event.
|
|
16
|
+
def on_comment(msg)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Called for a end document event.
|
|
20
|
+
def on_end_document
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Called for a end element event.
|
|
24
|
+
def on_end_element_ns(name, prefix, uri)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Called for parser errors.
|
|
28
|
+
def on_error(msg)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Called for an external subset event.
|
|
32
|
+
def on_external_subset(name, external_id, system_id)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Called for an external subset notification event.
|
|
36
|
+
def on_has_external_subset
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Called for an internal subset notification event.
|
|
40
|
+
def on_has_internal_subset
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Called for an internal subset event.
|
|
44
|
+
def on_internal_subset(name, external_id, system_id)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Called for 'is standalone' event.
|
|
48
|
+
def on_is_standalone
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Called for an processing instruction event.
|
|
52
|
+
def on_processing_instruction(target, data)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Called for a reference event.
|
|
56
|
+
def on_reference(name)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Called for a start document event.
|
|
60
|
+
def on_start_document
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Called for a start element event.
|
|
64
|
+
def on_start_element_ns(name, attributes, prefix, uri, namespaces)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
module VerboseCallbacks
|
|
69
|
+
# Called for a CDATA block event.
|
|
70
|
+
def on_cdata_block(cdata)
|
|
71
|
+
STDOUT << "on_cdata_block" << "\n" <<
|
|
72
|
+
" cdata " << cdata << "\n"
|
|
73
|
+
STDOUT.flush
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Called for a characters event.
|
|
77
|
+
def on_characters(chars)
|
|
78
|
+
STDOUT << "on_characters" << "\n" <<
|
|
79
|
+
" chars " << chars << "\n"
|
|
80
|
+
STDOUT.flush
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Called for a comment event.
|
|
84
|
+
def on_comment(comment)
|
|
85
|
+
STDOUT << "on_comment" << "\n" <<
|
|
86
|
+
" comment: " << comment << "\n"
|
|
87
|
+
STDOUT.flush
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Called for a end document event.
|
|
91
|
+
def on_end_document
|
|
92
|
+
STDOUT << "on_end_document\n"
|
|
93
|
+
STDOUT.flush
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Called for a end element event.
|
|
97
|
+
def on_end_element_ns(name, prefix, uri)
|
|
98
|
+
STDOUT << "on_end_element_ns" << "\n" <<
|
|
99
|
+
" name: " << name << "\n" <<
|
|
100
|
+
" prefix: " << prefix << "\n" <<
|
|
101
|
+
" uri: " << uri << "\n"
|
|
102
|
+
STDOUT.flush
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Called for parser errors.
|
|
106
|
+
def on_error(error)
|
|
107
|
+
STDOUT << "on_error" << "\n"
|
|
108
|
+
" error " << error << "\n"
|
|
109
|
+
STDOUT.flush
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Called for an external subset event.
|
|
113
|
+
def on_external_subset(name, external_id, system_id)
|
|
114
|
+
STDOUT << "on_external_subset" << "\n"
|
|
115
|
+
" external_id " << external_id << "\n" <<
|
|
116
|
+
" system_id " << system_id << "\n"
|
|
117
|
+
STDOUT.flush
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Called for an external subset notification event.
|
|
121
|
+
def on_has_external_subset
|
|
122
|
+
STDOUT << "on_has_internal_subset\n"
|
|
123
|
+
STDOUT.flush
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Called for an internal subset notification event.
|
|
127
|
+
def on_has_internal_subset
|
|
128
|
+
STDOUT << "on_has_internal_subset\n"
|
|
129
|
+
STDOUT.flush
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Called for an internal subset event.
|
|
133
|
+
def on_internal_subset(name, external_id, system_id)
|
|
134
|
+
STDOUT << "on_internal_subset" << "\n"
|
|
135
|
+
" external_id " << external_id << "\n" <<
|
|
136
|
+
" system_id " << system_id << "\n"
|
|
137
|
+
STDOUT.flush
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Called for 'is standalone' event.
|
|
141
|
+
def on_is_standalone
|
|
142
|
+
STDOUT << "on_is_standalone\n"
|
|
143
|
+
STDOUT.flush
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Called for an processing instruction event.
|
|
147
|
+
def on_processing_instruction(target, data)
|
|
148
|
+
STDOUT << "on_characters" << "\n"
|
|
149
|
+
" target: " << target << "\n" <<
|
|
150
|
+
" data: " << data << "\n"
|
|
151
|
+
STDOUT.flush
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Called for a reference event.
|
|
155
|
+
def on_reference(name)
|
|
156
|
+
STDOUT << "on_reference:" << "\n" <<
|
|
157
|
+
" name:" << name << "\n"
|
|
158
|
+
STDOUT.flush
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Called for a start document event.
|
|
162
|
+
def on_start_document
|
|
163
|
+
STDOUT << "on_start_document\n"
|
|
164
|
+
STDOUT.flush
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Called for a start element event.
|
|
168
|
+
def on_start_element_ns(name, attributes, prefix, uri, namespaces)
|
|
169
|
+
STDOUT << "on_start_element_ns" << "\n" <<
|
|
170
|
+
" name: " << name << "\n" <<
|
|
171
|
+
" attr: " << (attributes || Hash.new).inspect << "\n" <<
|
|
172
|
+
" prefix: " << prefix << "\n" <<
|
|
173
|
+
" uri: " << uri << "\n" <<
|
|
174
|
+
" ns_defs: " << (namespaces || Hash.new).inspect << "\n"
|
|
175
|
+
STDOUT.flush
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
178
180
|
end
|
data/lib/libxml/sax_parser.rb
CHANGED
|
@@ -1,56 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
module LibXML
|
|
4
|
+
module XML
|
|
5
|
+
class SaxParser
|
|
6
|
+
# call-seq:
|
|
7
|
+
# XML::SaxParser.file(path) -> XML::SaxParser
|
|
8
|
+
#
|
|
9
|
+
# Creates a new parser by parsing the specified file or uri.
|
|
10
|
+
def self.file(path)
|
|
11
|
+
context = XML::Parser::Context.file(path)
|
|
12
|
+
self.new(context)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# call-seq:
|
|
16
|
+
# XML::SaxParser.io(io) -> XML::SaxParser
|
|
17
|
+
# XML::SaxParser.io(io, :encoding => XML::Encoding::UTF_8) -> XML::SaxParser
|
|
18
|
+
#
|
|
19
|
+
# Creates a new reader by parsing the specified io object.
|
|
20
|
+
#
|
|
21
|
+
# Parameters:
|
|
22
|
+
#
|
|
23
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
|
24
|
+
# are the encoding constants defined on XML::Encoding.
|
|
25
|
+
def self.io(io, options = {})
|
|
26
|
+
context = XML::Parser::Context.io(io)
|
|
27
|
+
context.encoding = options[:encoding] if options[:encoding]
|
|
28
|
+
self.new(context)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# call-seq:
|
|
32
|
+
# XML::SaxParser.string(string)
|
|
33
|
+
#
|
|
34
|
+
# Creates a new parser by parsing the specified string.
|
|
35
|
+
def self.string(string)
|
|
36
|
+
context = XML::Parser::Context.string(string)
|
|
37
|
+
self.new(context)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# :enddoc:
|
|
41
|
+
|
|
42
|
+
def file=(value)
|
|
43
|
+
warn("XML::SaxParser#file is deprecated. Use XML::SaxParser.file instead")
|
|
44
|
+
@context = XML::Parser::Context.file(value)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def io=(value)
|
|
48
|
+
warn("XML::SaxParser#io is deprecated. Use XML::SaxParser.io instead")
|
|
49
|
+
@context = XML::Parser::Context.io(value)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def string=(value)
|
|
53
|
+
warn("XML::SaxParser#string is deprecated. Use XML::SaxParser.string instead")
|
|
54
|
+
@context = XML::Parser::Context.string(value)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
56
58
|
end
|