libxml-ruby 0.9.7-x86-mswin32-60 → 0.9.8-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +53 -0
- data/Rakefile +1 -0
- data/ext/libxml/build.log +4 -0
- data/ext/libxml/cbg.c +86 -86
- data/ext/libxml/libxml.c +878 -876
- data/ext/libxml/ruby_libxml.h +8 -4
- data/ext/libxml/ruby_xml_attr.c +36 -168
- data/ext/libxml/ruby_xml_attr.h +2 -4
- data/ext/libxml/ruby_xml_attr_decl.c +177 -0
- data/ext/libxml/ruby_xml_attr_decl.h +13 -0
- data/ext/libxml/ruby_xml_attributes.c +29 -20
- data/ext/libxml/ruby_xml_document.c +895 -898
- data/ext/libxml/ruby_xml_dtd.c +18 -1
- data/ext/libxml/ruby_xml_dtd.h +1 -0
- data/ext/libxml/ruby_xml_encoding.c +116 -0
- data/ext/libxml/ruby_xml_encoding.h +12 -0
- data/ext/libxml/ruby_xml_error.c +8 -2
- data/ext/libxml/ruby_xml_html_parser.c +53 -74
- data/ext/libxml/ruby_xml_html_parser.h +2 -3
- data/ext/libxml/ruby_xml_html_parser_context.c +145 -0
- data/ext/libxml/ruby_xml_html_parser_context.h +12 -0
- data/ext/libxml/ruby_xml_html_parser_options.c +48 -0
- data/ext/libxml/ruby_xml_html_parser_options.h +12 -0
- data/ext/libxml/ruby_xml_input_cbg.c +1 -1
- data/ext/libxml/ruby_xml_io.c +30 -0
- data/ext/libxml/ruby_xml_io.h +9 -0
- data/ext/libxml/ruby_xml_namespace.c +34 -16
- data/ext/libxml/ruby_xml_namespace.h +2 -2
- data/ext/libxml/ruby_xml_namespaces.c +6 -6
- data/ext/libxml/ruby_xml_node.c +1367 -1324
- data/ext/libxml/ruby_xml_node.h +2 -2
- data/ext/libxml/ruby_xml_parser.c +26 -78
- data/ext/libxml/ruby_xml_parser.h +1 -1
- data/ext/libxml/ruby_xml_parser_context.c +284 -13
- data/ext/libxml/ruby_xml_parser_context.h +1 -2
- data/ext/libxml/ruby_xml_parser_options.c +75 -0
- data/ext/libxml/ruby_xml_parser_options.h +14 -0
- data/ext/libxml/ruby_xml_reader.c +277 -183
- data/ext/libxml/ruby_xml_sax_parser.c +60 -57
- data/ext/libxml/ruby_xml_xpath_context.c +43 -8
- data/ext/libxml/ruby_xml_xpath_expression.c +6 -0
- data/ext/libxml/ruby_xml_xpath_object.c +107 -95
- data/ext/libxml/ruby_xml_xpath_object.h +9 -1
- data/ext/libxml/ruby_xml_xpointer.c +107 -107
- data/ext/libxml/version.h +2 -2
- data/ext/mingw/libxml_ruby.dll.a +0 -0
- data/ext/mingw/libxml_ruby.so +0 -0
- data/ext/vc/libxml_ruby.vcproj +43 -3
- data/lib/libxml.rb +2 -3
- data/lib/libxml/attr.rb +71 -2
- data/lib/libxml/attr_decl.rb +81 -0
- data/lib/libxml/document.rb +78 -14
- data/lib/libxml/html_parser.rb +75 -42
- data/lib/libxml/node.rb +11 -0
- data/lib/libxml/parser.rb +106 -62
- data/lib/libxml/reader.rb +12 -0
- data/lib/libxml/sax_parser.rb +42 -52
- data/lib/libxml/xpath_object.rb +15 -0
- data/test/model/atom.xml +12 -12
- data/test/model/bands.xml +4 -4
- data/test/model/books.xml +146 -147
- data/test/model/merge_bug_data.xml +1 -1
- data/test/model/rubynet.xml +1 -0
- data/test/model/shiporder.rng +1 -1
- data/test/model/shiporder.xml +22 -22
- data/test/model/shiporder.xsd +30 -30
- data/test/model/xinclude.xml +1 -1
- data/test/{tc_node_attr.rb → tc_attr.rb} +1 -1
- data/test/tc_attr_decl.rb +131 -0
- data/test/tc_deprecated_require.rb +1 -3
- data/test/tc_document.rb +13 -3
- data/test/tc_document_write.rb +5 -5
- data/test/tc_dtd.rb +13 -5
- data/test/tc_html_parser.rb +14 -26
- data/test/tc_node_cdata.rb +1 -3
- data/test/tc_node_comment.rb +2 -4
- data/test/tc_node_edit.rb +2 -3
- data/test/tc_node_text.rb +35 -1
- data/test/tc_node_write.rb +3 -3
- data/test/tc_node_xlink.rb +2 -4
- data/test/tc_parser.rb +163 -70
- data/test/tc_parser_context.rb +103 -42
- data/test/tc_reader.rb +173 -45
- data/test/tc_relaxng.rb +2 -2
- data/test/tc_sax_parser.rb +48 -52
- data/test/tc_schema.rb +2 -2
- data/test/tc_xpath.rb +37 -6
- data/test/tc_xpath_context.rb +7 -1
- data/test/tc_xpath_expression.rb +1 -3
- data/test/tc_xpointer.rb +1 -3
- data/test/test_suite.rb +2 -3
- metadata +20 -13
- data/ext/libxml/ruby_xml_input.c +0 -329
- data/ext/libxml/ruby_xml_input.h +0 -20
- data/lib/libxml/parser_context.rb +0 -17
- data/lib/libxml/parser_options.rb +0 -25
- data/test/model/simple.xml +0 -7
- data/test/tc_input.rb +0 -13
- data/test/tc_well_formed.rb +0 -11
@@ -0,0 +1,81 @@
|
|
1
|
+
# $Id: libxml.rb 374 2008-07-11 04:51:41Z cfis $
|
2
|
+
# Please see the LICENSE file for copyright and distribution information
|
3
|
+
|
4
|
+
module LibXML
|
5
|
+
module XML
|
6
|
+
class AttrDecl
|
7
|
+
include Enumerable
|
8
|
+
|
9
|
+
# call-seq:
|
10
|
+
# attr_decl.child -> nil
|
11
|
+
#
|
12
|
+
# Obtain this attribute declaration's child attribute(s).
|
13
|
+
# It will always be nil.
|
14
|
+
def child
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
18
|
+
# call-seq:
|
19
|
+
# attr_decl.child? -> (true|false)
|
20
|
+
#
|
21
|
+
# Returns whether this attribute declaration has child attributes.
|
22
|
+
#
|
23
|
+
def child?
|
24
|
+
not self.children.nil?
|
25
|
+
end
|
26
|
+
|
27
|
+
# call-seq:
|
28
|
+
# attr_decl.doc? -> (true|false)
|
29
|
+
#
|
30
|
+
# Determine whether this attribute declaration is associated with an
|
31
|
+
# XML::Document.
|
32
|
+
def doc?
|
33
|
+
not self.doc.nil?
|
34
|
+
end
|
35
|
+
|
36
|
+
# call-seq:
|
37
|
+
# attr_decl.next? -> (true|false)
|
38
|
+
#
|
39
|
+
# Determine whether there is a next attribute declaration.
|
40
|
+
def next?
|
41
|
+
not self.next.nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
# call-seq:
|
45
|
+
# attr_decl.parent? -> (true|false)
|
46
|
+
#
|
47
|
+
# Determine whether this attribute declaration has a parent .
|
48
|
+
def parent?
|
49
|
+
not self.parent.nil?
|
50
|
+
end
|
51
|
+
|
52
|
+
# call-seq:
|
53
|
+
# attr_decl.prev? -> (true|false)
|
54
|
+
#
|
55
|
+
# Determine whether there is a previous attribute declaration.
|
56
|
+
def prev?
|
57
|
+
not self.prev.nil?
|
58
|
+
end
|
59
|
+
|
60
|
+
# call-seq:
|
61
|
+
# attr_decl.node_type_name -> 'attribute declaration'
|
62
|
+
#
|
63
|
+
# Returns this attribute declaration's node type name.
|
64
|
+
def node_type_name
|
65
|
+
if node_type == Node::ATTRIBUTE_DECL
|
66
|
+
'attribute declaration'
|
67
|
+
else
|
68
|
+
raise(UnknownType, "Unknown node type: %n", node.node_type);
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# call-seq:
|
73
|
+
# attr_decl.to_s -> string
|
74
|
+
#
|
75
|
+
# Returns a string representation of this attribute declaration.
|
76
|
+
def to_s
|
77
|
+
"#{name} = #{value}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/libxml/document.rb
CHANGED
@@ -1,20 +1,77 @@
|
|
1
1
|
module LibXML
|
2
2
|
module XML
|
3
3
|
class Document
|
4
|
-
|
5
|
-
|
4
|
+
# call-seq:
|
5
|
+
# XML::Document.document(document) -> XML::Document
|
6
|
+
#
|
7
|
+
# Creates a new document based on the specified document.
|
8
|
+
#
|
9
|
+
# Parameters:
|
10
|
+
#
|
11
|
+
# document - A preparsed document.
|
12
|
+
def self.document(value)
|
13
|
+
Parser.document(value).parse
|
6
14
|
end
|
7
15
|
|
8
|
-
|
9
|
-
|
16
|
+
# call-seq:
|
17
|
+
# XML::Document.file(path) -> XML::Document
|
18
|
+
# XML::Document.file(path, :encoding => XML::Encoding::UTF_8,
|
19
|
+
# :options => XML::Parser::Options::NOENT) -> XML::Document
|
20
|
+
#
|
21
|
+
# Creates a new document from the specified file or uri.
|
22
|
+
#
|
23
|
+
# You may provide an optional hash table to control how the
|
24
|
+
# parsing is performed. Valid options are:
|
25
|
+
#
|
26
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
27
|
+
# are the encoding constants defined on XML::Encoding.
|
28
|
+
# options - Parser options. Valid values are the constants defined on
|
29
|
+
# XML::Parser::Options. Mutliple options can be combined
|
30
|
+
# by using Bitwise OR (|).
|
31
|
+
def self.file(value, options = {})
|
32
|
+
Parser.file(value, options).parse
|
10
33
|
end
|
11
34
|
|
12
|
-
|
13
|
-
|
35
|
+
# call-seq:
|
36
|
+
# XML::Document.io(io) -> XML::Document
|
37
|
+
# XML::Document.io(io, :encoding => XML::Encoding::UTF_8,
|
38
|
+
# :options => XML::Parser::Options::NOENT
|
39
|
+
# :base_uri="http://libxml.org") -> XML::Document
|
40
|
+
#
|
41
|
+
# Creates a new document from the specified io object.
|
42
|
+
#
|
43
|
+
# Parameters:
|
44
|
+
#
|
45
|
+
# io - io object that contains the xml to parser
|
46
|
+
# base_uri - The base url for the parsed document.
|
47
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
48
|
+
# are the encoding constants defined on XML::Encoding.
|
49
|
+
# options - Parser options. Valid values are the constants defined on
|
50
|
+
# XML::Parser::Options. Mutliple options can be combined
|
51
|
+
# by using Bitwise OR (|).
|
52
|
+
def self.io(value, options = {})
|
53
|
+
Parser.io(value, options).parse
|
14
54
|
end
|
15
55
|
|
16
|
-
|
17
|
-
|
56
|
+
# call-seq:
|
57
|
+
# XML::Document.string(string)
|
58
|
+
# XML::Document.string(string, :encoding => XML::Encoding::UTF_8,
|
59
|
+
# :options => XML::Parser::Options::NOENT
|
60
|
+
# :base_uri="http://libxml.org") -> XML::Document
|
61
|
+
#
|
62
|
+
# Creates a new document from the specified string.
|
63
|
+
#
|
64
|
+
# You may provide an optional hash table to control how the
|
65
|
+
# parsing is performed. Valid options are:
|
66
|
+
#
|
67
|
+
# base_uri - The base url for the parsed document.
|
68
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
69
|
+
# are the encoding constants defined on XML::Encoding.
|
70
|
+
# options - Parser options. Valid values are the constants defined on
|
71
|
+
# XML::Parser::Options. Mutliple options can be combined
|
72
|
+
# by using Bitwise OR (|).
|
73
|
+
def self.string(value, options = {})
|
74
|
+
Parser.string(value, options).parse
|
18
75
|
end
|
19
76
|
|
20
77
|
# Returns a new XML::XPathContext for the document.
|
@@ -70,31 +127,38 @@ module LibXML
|
|
70
127
|
def find_first(xpath, nslist = nil)
|
71
128
|
find(xpath, nslist).first
|
72
129
|
end
|
73
|
-
|
74
|
-
|
130
|
+
|
131
|
+
# :enddoc:
|
132
|
+
|
133
|
+
def dump
|
75
134
|
warn('Document#dump is deprecated. Use Document#to_s instead.')
|
76
135
|
self.to_s
|
77
136
|
end
|
78
137
|
|
79
|
-
def format_dump
|
138
|
+
def format_dump
|
80
139
|
warn('Document#format_dump is deprecated. Use Document#to_s instead.')
|
81
140
|
self.to_s
|
82
141
|
end
|
83
142
|
|
84
|
-
def debug_dump
|
143
|
+
def debug_dump
|
85
144
|
warn('Document#debug_dump is deprecated. Use Document#debug instead.')
|
86
145
|
self.debug
|
87
146
|
end
|
88
147
|
|
89
|
-
def debug_dump_head
|
148
|
+
def debug_dump_head
|
90
149
|
warn('Document#debug_dump_head is deprecated. Use Document#debug instead.')
|
91
150
|
self.debug
|
92
151
|
end
|
93
152
|
|
94
|
-
def debug_format_dump
|
153
|
+
def debug_format_dump
|
95
154
|
warn('Document#debug_format_dump is deprecated. Use Document#to_s instead.')
|
96
155
|
self.to_s
|
97
156
|
end
|
157
|
+
|
158
|
+
def reader
|
159
|
+
warn('Document#reader is deprecated. Use XML::Reader.document(self) instead.')
|
160
|
+
XML::Reader.document(self)
|
161
|
+
end
|
98
162
|
end
|
99
163
|
end
|
100
164
|
end
|
data/lib/libxml/html_parser.rb
CHANGED
@@ -1,61 +1,94 @@
|
|
1
1
|
module LibXML
|
2
2
|
module XML
|
3
3
|
class HTMLParser
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
# call-seq:
|
5
|
+
# XML::HTMLParser.file(path) -> XML::HTMLParser
|
6
|
+
# XML::HTMLParser.file(path, :encoding => XML::Encoding::UTF_8,
|
7
|
+
# :options => XML::HTMLParser::Options::NOENT) -> XML::HTMLParser
|
8
|
+
#
|
9
|
+
# Creates a new parser by parsing the specified file or uri.
|
10
|
+
#
|
11
|
+
# You may provide an optional hash table to control how the
|
12
|
+
# parsing is performed. Valid options are:
|
13
|
+
#
|
14
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
15
|
+
# are the encoding constants defined on XML::Encoding.
|
16
|
+
# options - Parser options. Valid values are the constants defined on
|
17
|
+
# XML::HTMLParser::Options. Mutliple options can be combined
|
18
|
+
# by using Bitwise OR (|).
|
19
|
+
def self.file(path, options = {})
|
20
|
+
context = XML::HTMLParser::Context.file(path)
|
21
|
+
context.encoding = options[:encoding] if options[:encoding]
|
22
|
+
context.options = options[:options] if options[:options]
|
23
|
+
self.new(context)
|
8
24
|
end
|
9
25
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
26
|
+
# call-seq:
|
27
|
+
# XML::HTMLParser.io(io) -> XML::HTMLParser
|
28
|
+
# XML::HTMLParser.io(io, :encoding => XML::Encoding::UTF_8,
|
29
|
+
# :options => XML::HTMLParser::Options::NOENT
|
30
|
+
# :base_uri="http://libxml.org") -> XML::HTMLParser
|
31
|
+
#
|
32
|
+
# Creates a new reader by parsing the specified io object.
|
33
|
+
#
|
34
|
+
# Parameters:
|
35
|
+
#
|
36
|
+
# io - io object that contains the xml to parser
|
37
|
+
# base_uri - The base url for the parsed document.
|
38
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
39
|
+
# are the encoding constants defined on XML::Encoding.
|
40
|
+
# options - Parser options. Valid values are the constants defined on
|
41
|
+
# XML::HTMLParser::Options. Mutliple options can be combined
|
42
|
+
# by using Bitwise OR (|).
|
43
|
+
def self.io(io, options = {})
|
44
|
+
context = XML::HTMLParser::Context.io(io)
|
45
|
+
context.base_uri = options[:base_uri] if options[:base_uri]
|
46
|
+
context.encoding = options[:encoding] if options[:encoding]
|
47
|
+
context.options = options[:options] if options[:options]
|
48
|
+
self.new(context)
|
14
49
|
end
|
15
50
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
51
|
+
# call-seq:
|
52
|
+
# XML::HTMLParser.string(string)
|
53
|
+
# XML::HTMLParser.string(string, :encoding => XML::Encoding::UTF_8,
|
54
|
+
# :options => XML::HTMLParser::Options::NOENT
|
55
|
+
# :base_uri="http://libxml.org") -> XML::HTMLParser
|
56
|
+
#
|
57
|
+
# Creates a new parser by parsing the specified string.
|
58
|
+
#
|
59
|
+
# You may provide an optional hash table to control how the
|
60
|
+
# parsing is performed. Valid options are:
|
61
|
+
#
|
62
|
+
# base_uri - The base url for the parsed document.
|
63
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
64
|
+
# are the encoding constants defined on XML::Encoding.
|
65
|
+
# options - Parser options. Valid values are the constants defined on
|
66
|
+
# XML::HTMLParser::Options. Mutliple options can be combined
|
67
|
+
# by using Bitwise OR (|).
|
68
|
+
def self.string(string, options = {})
|
69
|
+
context = XML::HTMLParser::Context.string(string)
|
70
|
+
context.base_uri = options[:base_uri] if options[:base_uri]
|
71
|
+
context.encoding = options[:encoding] if options[:encoding]
|
72
|
+
context.options = options[:options] if options[:options]
|
73
|
+
self.new(context)
|
20
74
|
end
|
21
75
|
|
22
|
-
|
23
|
-
parser = self.new
|
24
|
-
parser.input.io = value
|
25
|
-
parser
|
26
|
-
end
|
27
|
-
|
28
|
-
def file
|
29
|
-
input.file
|
30
|
-
end
|
76
|
+
# :enddoc:
|
31
77
|
|
32
78
|
def file=(value)
|
33
|
-
|
79
|
+
warn("XML::HTMLParser#file is deprecated. Use XML::HTMLParser.file instead")
|
80
|
+
@context = XML::HTMLParser::Context.file(value)
|
34
81
|
end
|
35
82
|
|
36
|
-
def
|
37
|
-
|
83
|
+
def io=(value)
|
84
|
+
warn("XML::HTMLParser#io is deprecated. Use XML::HTMLParser.io instead")
|
85
|
+
@context = XML::HTMLParser::Context.io(value)
|
38
86
|
end
|
39
87
|
|
40
88
|
def string=(value)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
def document
|
45
|
-
input.document
|
46
|
-
end
|
47
|
-
|
48
|
-
def document=(value)
|
49
|
-
input.document = value
|
50
|
-
end
|
51
|
-
|
52
|
-
def io
|
53
|
-
input.io
|
54
|
-
end
|
55
|
-
|
56
|
-
def io=(value)
|
57
|
-
input.io = value
|
89
|
+
warn("XML::HTMLParser#string is deprecated. Use XML::HTMLParser.string instead")
|
90
|
+
@context = XML::HTMLParser::Context.string(value)
|
58
91
|
end
|
59
92
|
end
|
60
93
|
end
|
61
|
-
end
|
94
|
+
end
|
data/lib/libxml/node.rb
CHANGED
@@ -329,6 +329,16 @@ module LibXML
|
|
329
329
|
!self.namespaces.definitions.nil?
|
330
330
|
end
|
331
331
|
|
332
|
+
def base
|
333
|
+
warn('Node#base is deprecated. Use Node#base_uri.')
|
334
|
+
self.base_uri
|
335
|
+
end
|
336
|
+
|
337
|
+
def base=(value)
|
338
|
+
warn('Node#base= is deprecated. Use Node#base_uri=.')
|
339
|
+
self.base_uri = value
|
340
|
+
end
|
341
|
+
|
332
342
|
def search_ns(prefix)
|
333
343
|
warn('Node#search_ns is deprecated. Use Node#namespaces.find_by_prefix instead.')
|
334
344
|
self.namespaces.find_by_prefix(prefix)
|
@@ -338,6 +348,7 @@ module LibXML
|
|
338
348
|
warn('Node#search_href is deprecated. Use Node#namespaces.find_by_href instead.')
|
339
349
|
self.namespaces.find_by_href(href)
|
340
350
|
end
|
351
|
+
|
341
352
|
# :startdoc:
|
342
353
|
end
|
343
354
|
end
|
data/lib/libxml/parser.rb
CHANGED
@@ -1,33 +1,89 @@
|
|
1
1
|
module LibXML
|
2
2
|
module XML
|
3
3
|
class Parser
|
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
|
-
|
4
|
+
# call-seq:
|
5
|
+
# XML::Parser.document(document) -> XML::Parser
|
6
|
+
#
|
7
|
+
# Creates a new parser for the specified document.
|
8
|
+
#
|
9
|
+
# Parameters:
|
10
|
+
#
|
11
|
+
# document - A preparsed document.
|
12
|
+
def self.document(doc)
|
13
|
+
context = XML::Parser::Context.document(doc)
|
14
|
+
self.new(context)
|
15
|
+
end
|
16
|
+
|
17
|
+
# call-seq:
|
18
|
+
# XML::Parser.file(path) -> XML::Parser
|
19
|
+
# XML::Parser.file(path, :encoding => XML::Encoding::UTF_8,
|
20
|
+
# :options => XML::Parser::Options::NOENT) -> XML::Parser
|
21
|
+
#
|
22
|
+
# Creates a new parser for the specified file or uri.
|
23
|
+
#
|
24
|
+
# You may provide an optional hash table to control how the
|
25
|
+
# parsing is performed. Valid options are:
|
26
|
+
#
|
27
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
28
|
+
# are the encoding constants defined on XML::Encoding.
|
29
|
+
# options - Parser options. Valid values are the constants defined on
|
30
|
+
# XML::Parser::Options. Mutliple options can be combined
|
31
|
+
# by using Bitwise OR (|).
|
32
|
+
def self.file(path, options = {})
|
33
|
+
context = XML::Parser::Context.file(path)
|
34
|
+
context.encoding = options[:encoding] if options[:encoding]
|
35
|
+
context.options = options[:options] if options[:options]
|
36
|
+
self.new(context)
|
37
|
+
end
|
38
|
+
|
39
|
+
# call-seq:
|
40
|
+
# XML::Parser.io(io) -> XML::Parser
|
41
|
+
# XML::Parser.io(io, :encoding => XML::Encoding::UTF_8,
|
42
|
+
# :options => XML::Parser::Options::NOENT
|
43
|
+
# :base_uri="http://libxml.org") -> XML::Parser
|
44
|
+
#
|
45
|
+
# Creates a new parser for the specified io object.
|
46
|
+
#
|
47
|
+
# Parameters:
|
48
|
+
#
|
49
|
+
# io - io object that contains the xml to parser
|
50
|
+
# base_uri - The base url for the parsed document.
|
51
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
52
|
+
# are the encoding constants defined on XML::Encoding.
|
53
|
+
# options - Parser options. Valid values are the constants defined on
|
54
|
+
# XML::Parser::Options. Mutliple options can be combined
|
55
|
+
# by using Bitwise OR (|).
|
56
|
+
def self.io(io, options = {})
|
57
|
+
context = XML::Parser::Context.io(io)
|
58
|
+
context.base_uri = options[:base_uri] if options[:base_uri]
|
59
|
+
context.encoding = options[:encoding] if options[:encoding]
|
60
|
+
context.options = options[:options] if options[:options]
|
61
|
+
self.new(context)
|
62
|
+
end
|
63
|
+
|
64
|
+
# call-seq:
|
65
|
+
# XML::Parser.string(string)
|
66
|
+
# XML::Parser.string(string, :encoding => XML::Encoding::UTF_8,
|
67
|
+
# :options => XML::Parser::Options::NOENT
|
68
|
+
# :base_uri="http://libxml.org") -> XML::Parser
|
69
|
+
#
|
70
|
+
# Creates a new parser by parsing the specified string.
|
71
|
+
#
|
72
|
+
# You may provide an optional hash table to control how the
|
73
|
+
# parsing is performed. Valid options are:
|
74
|
+
#
|
75
|
+
# base_uri - The base url for the parsed document.
|
76
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
77
|
+
# are the encoding constants defined on XML::Encoding.
|
78
|
+
# options - Parser options. Valid values are the constants defined on
|
79
|
+
# XML::Parser::Options. Mutliple options can be combined
|
80
|
+
# by using Bitwise OR (|).
|
81
|
+
def self.string(string, options = {})
|
82
|
+
context = XML::Parser::Context.string(string)
|
83
|
+
context.base_uri = options[:base_uri] if options[:base_uri]
|
84
|
+
context.encoding = options[:encoding] if options[:encoding]
|
85
|
+
context.options = options[:options] if options[:options]
|
86
|
+
self.new(context)
|
31
87
|
end
|
32
88
|
|
33
89
|
def self.register_error_handler(proc)
|
@@ -39,53 +95,36 @@ module LibXML
|
|
39
95
|
end
|
40
96
|
end
|
41
97
|
|
42
|
-
|
43
|
-
warn("Parser#filename is deprecated. Use Parser#file instead")
|
44
|
-
self.file
|
45
|
-
end
|
98
|
+
# :enddoc:
|
46
99
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
100
|
+
# Bunch of deprecated methods that have moved to the XML module
|
101
|
+
VERSION = XML::VERSION
|
102
|
+
VERNUM = XML::VERNUM
|
51
103
|
|
52
|
-
def
|
53
|
-
|
104
|
+
def document=(value)
|
105
|
+
warn("XML::Parser#document= is deprecated. Use XML::Parser.document= instead")
|
106
|
+
@context = XML::Parser::Context.document(value)
|
54
107
|
end
|
55
108
|
|
56
109
|
def file=(value)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
def string
|
61
|
-
input.string
|
110
|
+
warn("XML::Parser#file is deprecated. Use XML::Parser.file instead")
|
111
|
+
@context = XML::Parser::Context.file(value)
|
62
112
|
end
|
63
113
|
|
64
|
-
def
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
def document
|
69
|
-
input.document
|
70
|
-
end
|
71
|
-
|
72
|
-
def document=(value)
|
73
|
-
input.document = value
|
74
|
-
end
|
75
|
-
|
76
|
-
def io
|
77
|
-
input.io
|
114
|
+
def filename=(value)
|
115
|
+
warn("XML::Parser#filename is deprecated. Use XML::Parser.file instead")
|
116
|
+
self.file = value
|
78
117
|
end
|
79
118
|
|
80
119
|
def io=(value)
|
81
|
-
|
120
|
+
warn("XML::Parser#io is deprecated. Use XML::Parser.io instead")
|
121
|
+
@context = XML::Parser::Context.io(value)
|
82
122
|
end
|
83
123
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
VERNUM = XML::VERNUM
|
124
|
+
def string=(value)
|
125
|
+
warn("XML::Parser#string is deprecated. Use XML::Parser.string instead")
|
126
|
+
@context = XML::Parser::Context.string(value)
|
127
|
+
end
|
89
128
|
|
90
129
|
def self.enabled_automata?
|
91
130
|
warn("XML::Parser.enabled_automata? has been deprecated. Use XML.enabled_automata? instead")
|
@@ -307,6 +346,11 @@ module LibXML
|
|
307
346
|
XML.indent_tree_output= value
|
308
347
|
end
|
309
348
|
|
349
|
+
def self.filename(value)
|
350
|
+
warn("Parser.filename is deprecated. Use Parser.file instead")
|
351
|
+
self.file(value)
|
352
|
+
end
|
353
|
+
|
310
354
|
def self.memory_dump
|
311
355
|
warn("XML::Parser.memory_dump has been deprecated. Use XML.memory_dump instead")
|
312
356
|
XML.memory_dump
|