libxml-ruby 1.1.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/error.rb
CHANGED
@@ -1,88 +1,90 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
self.
|
22
|
-
self.
|
23
|
-
self.
|
24
|
-
self.
|
25
|
-
self.
|
26
|
-
self.
|
27
|
-
self.
|
28
|
-
self.
|
29
|
-
self.
|
30
|
-
self.
|
31
|
-
self.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
when
|
39
|
-
'
|
40
|
-
when
|
41
|
-
'
|
42
|
-
when
|
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
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
end
|
87
|
-
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module LibXML
|
4
|
+
module XML
|
5
|
+
class Error
|
6
|
+
# Verbose error handler
|
7
|
+
VERBOSE_HANDLER = lambda do |error|
|
8
|
+
STDERR << error.to_s << "\n"
|
9
|
+
STDERR.flush
|
10
|
+
end
|
11
|
+
|
12
|
+
# Quiet error handler
|
13
|
+
QUIET_HANDLER = lambda do |error|
|
14
|
+
end
|
15
|
+
|
16
|
+
def ==(other)
|
17
|
+
eql?(other)
|
18
|
+
end
|
19
|
+
|
20
|
+
def eql?(other)
|
21
|
+
self.code == other.code and
|
22
|
+
self.domain == other.domain and
|
23
|
+
self.message == other.message and
|
24
|
+
self.level == other.level and
|
25
|
+
self.file == other.file and
|
26
|
+
self.line == other.line and
|
27
|
+
self.str1 == other.str1 and
|
28
|
+
self.str2 == other.str2 and
|
29
|
+
self.str3 == other.str3 and
|
30
|
+
self.int1 == other.int1 and
|
31
|
+
self.int2 == other.int2 and
|
32
|
+
self.ctxt == other.ctxt and
|
33
|
+
self.node == other.node
|
34
|
+
end
|
35
|
+
|
36
|
+
def level_to_s
|
37
|
+
case self.level
|
38
|
+
when NONE
|
39
|
+
''
|
40
|
+
when WARNING
|
41
|
+
'Warning:'
|
42
|
+
when ERROR
|
43
|
+
'Error:'
|
44
|
+
when FATAL
|
45
|
+
'Fatal error:'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def domain_to_s
|
50
|
+
const_map = Hash.new
|
51
|
+
domains = self.class.constants.grep(/XML_FROM/)
|
52
|
+
domains.each do |domain|
|
53
|
+
human_name = domain.gsub(/XML_FROM_/, '')
|
54
|
+
const_map[self.class.const_get(domain)] = human_name
|
55
|
+
end
|
56
|
+
|
57
|
+
const_map[self.domain]
|
58
|
+
end
|
59
|
+
|
60
|
+
def code_to_s
|
61
|
+
const_map = Hash.new
|
62
|
+
codes = self.class.constants -
|
63
|
+
self.class.constants.grep(/XML_FROM/) -
|
64
|
+
["XML_ERR_NONE", "XML_ERR_WARNING", "XML_ERR_ERROR", "XML_ERR_FATAL"]
|
65
|
+
|
66
|
+
|
67
|
+
codes.each do |code|
|
68
|
+
human_name = code.gsub(/XML_ERR_/, '')
|
69
|
+
const_map[self.class.const_get(code)] = human_name
|
70
|
+
end
|
71
|
+
|
72
|
+
const_map[self.code]
|
73
|
+
end
|
74
|
+
|
75
|
+
def to_s
|
76
|
+
msg = super
|
77
|
+
msg = msg ? msg.strip: ''
|
78
|
+
|
79
|
+
if self.line
|
80
|
+
sprintf("%s %s at %s:%d.", self.level_to_s, msg,
|
81
|
+
self.file, self.line)
|
82
|
+
else
|
83
|
+
sprintf("%s %s.", self.level_to_s, msg)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
88
90
|
LibXML::XML::Error.set_handler(&LibXML::XML::Error::VERBOSE_HANDLER)
|
data/lib/libxml/hpricot.rb
CHANGED
@@ -1,76 +1,78 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
# xp.
|
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
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
|
68
|
-
|
69
|
-
## alias_method :
|
70
|
-
## alias_method :
|
71
|
-
##
|
72
|
-
##
|
73
|
-
## alias :child :first
|
74
|
-
|
75
|
-
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
## Provide hpricot API for libxml. Provided by Michael Guterl,
|
4
|
+
## inspired by http://thebogles.com/blog/an-hpricot-style-interface-to-libxml
|
5
|
+
#
|
6
|
+
#class String
|
7
|
+
# def to_libxml_doc
|
8
|
+
# xp = XML::Parser.new
|
9
|
+
# xp.string = self
|
10
|
+
# xp.parse
|
11
|
+
# end
|
12
|
+
#end
|
13
|
+
#
|
14
|
+
#module LibXML
|
15
|
+
# module XML
|
16
|
+
# class Document
|
17
|
+
# alias :search :find
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# class Node
|
21
|
+
# # find the child node with the given xpath
|
22
|
+
# def at(xpath)
|
23
|
+
# self.find_first(xpath)
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# # find the array of child nodes matching the given xpath
|
27
|
+
# def search(xpath)
|
28
|
+
# results = self.find(xpath).to_a
|
29
|
+
# if block_given?
|
30
|
+
# results.each do |result|
|
31
|
+
# yield result
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
# return results
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# def /(xpath)
|
38
|
+
# search(xpath)
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# # return the inner contents of this node as a string
|
42
|
+
# def inner_xml
|
43
|
+
# child.to_s
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# # alias for inner_xml
|
47
|
+
# def inner_html
|
48
|
+
# inner_xml
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# # return this node and its contents as an xml string
|
52
|
+
# def to_xml
|
53
|
+
# self.to_s
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# # alias for path
|
57
|
+
# def xpath
|
58
|
+
# self.path
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# def find_with_default_ns(xpath_expr, namespace=nil)
|
62
|
+
# find_base(xpath_expr, namespace || default_namespaces)
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# def find_first_with_default_ns(xpath_expr, namespace=nil)
|
66
|
+
# find_first_base(xpath_expr, namespace || default_namespaces)
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
## alias_method :find_base, :find unless method_defined?(:find_base)
|
70
|
+
## alias_method :find, :find_with_default_ns
|
71
|
+
## alias_method :find_first_base, :find_first unless method_defined?(:find_first_base)
|
72
|
+
## alias_method :find_first, :find_first_with_default_ns
|
73
|
+
## alias :child? :first?
|
74
|
+
## alias :children? :first?
|
75
|
+
## alias :child :first
|
76
|
+
# end
|
77
|
+
# end
|
76
78
|
#end
|
data/lib/libxml/html_parser.rb
CHANGED
@@ -1,94 +1,96 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
context
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
context
|
47
|
-
context.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
context
|
72
|
-
context.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module LibXML
|
4
|
+
module XML
|
5
|
+
class HTMLParser
|
6
|
+
# call-seq:
|
7
|
+
# XML::HTMLParser.file(path) -> XML::HTMLParser
|
8
|
+
# XML::HTMLParser.file(path, :encoding => XML::Encoding::UTF_8,
|
9
|
+
# :options => XML::HTMLParser::Options::NOENT) -> XML::HTMLParser
|
10
|
+
#
|
11
|
+
# Creates a new parser by parsing the specified file or uri.
|
12
|
+
#
|
13
|
+
# You may provide an optional hash table to control how the
|
14
|
+
# parsing is performed. Valid options are:
|
15
|
+
#
|
16
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
17
|
+
# are the encoding constants defined on XML::Encoding.
|
18
|
+
# options - Parser options. Valid values are the constants defined on
|
19
|
+
# XML::HTMLParser::Options. Mutliple options can be combined
|
20
|
+
# by using Bitwise OR (|).
|
21
|
+
def self.file(path, options = {})
|
22
|
+
context = XML::HTMLParser::Context.file(path)
|
23
|
+
context.encoding = options[:encoding] if options[:encoding]
|
24
|
+
context.options = options[:options] if options[:options]
|
25
|
+
self.new(context)
|
26
|
+
end
|
27
|
+
|
28
|
+
# call-seq:
|
29
|
+
# XML::HTMLParser.io(io) -> XML::HTMLParser
|
30
|
+
# XML::HTMLParser.io(io, :encoding => XML::Encoding::UTF_8,
|
31
|
+
# :options => XML::HTMLParser::Options::NOENT
|
32
|
+
# :base_uri="http://libxml.org") -> XML::HTMLParser
|
33
|
+
#
|
34
|
+
# Creates a new reader by parsing the specified io object.
|
35
|
+
#
|
36
|
+
# Parameters:
|
37
|
+
#
|
38
|
+
# io - io object that contains the xml to parser
|
39
|
+
# base_uri - The base url for the parsed document.
|
40
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
41
|
+
# are the encoding constants defined on XML::Encoding.
|
42
|
+
# options - Parser options. Valid values are the constants defined on
|
43
|
+
# XML::HTMLParser::Options. Mutliple options can be combined
|
44
|
+
# by using Bitwise OR (|).
|
45
|
+
def self.io(io, options = {})
|
46
|
+
context = XML::HTMLParser::Context.io(io)
|
47
|
+
context.base_uri = options[:base_uri] if options[:base_uri]
|
48
|
+
context.encoding = options[:encoding] if options[:encoding]
|
49
|
+
context.options = options[:options] if options[:options]
|
50
|
+
self.new(context)
|
51
|
+
end
|
52
|
+
|
53
|
+
# call-seq:
|
54
|
+
# XML::HTMLParser.string(string)
|
55
|
+
# XML::HTMLParser.string(string, :encoding => XML::Encoding::UTF_8,
|
56
|
+
# :options => XML::HTMLParser::Options::NOENT
|
57
|
+
# :base_uri="http://libxml.org") -> XML::HTMLParser
|
58
|
+
#
|
59
|
+
# Creates a new parser by parsing the specified string.
|
60
|
+
#
|
61
|
+
# You may provide an optional hash table to control how the
|
62
|
+
# parsing is performed. Valid options are:
|
63
|
+
#
|
64
|
+
# base_uri - The base url for the parsed document.
|
65
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
66
|
+
# are the encoding constants defined on XML::Encoding.
|
67
|
+
# options - Parser options. Valid values are the constants defined on
|
68
|
+
# XML::HTMLParser::Options. Mutliple options can be combined
|
69
|
+
# by using Bitwise OR (|).
|
70
|
+
def self.string(string, options = {})
|
71
|
+
context = XML::HTMLParser::Context.string(string)
|
72
|
+
context.base_uri = options[:base_uri] if options[:base_uri]
|
73
|
+
context.encoding = options[:encoding] if options[:encoding]
|
74
|
+
context.options = options[:options] if options[:options]
|
75
|
+
self.new(context)
|
76
|
+
end
|
77
|
+
|
78
|
+
# :enddoc:
|
79
|
+
|
80
|
+
def file=(value)
|
81
|
+
warn("XML::HTMLParser#file is deprecated. Use XML::HTMLParser.file instead")
|
82
|
+
@context = XML::HTMLParser::Context.file(value)
|
83
|
+
end
|
84
|
+
|
85
|
+
def io=(value)
|
86
|
+
warn("XML::HTMLParser#io is deprecated. Use XML::HTMLParser.io instead")
|
87
|
+
@context = XML::HTMLParser::Context.io(value)
|
88
|
+
end
|
89
|
+
|
90
|
+
def string=(value)
|
91
|
+
warn("XML::HTMLParser#string is deprecated. Use XML::HTMLParser.string instead")
|
92
|
+
@context = XML::HTMLParser::Context.string(value)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|