Class: XSD::XMLParser::Parser
Defined Under Namespace
Classes: ElementConstraintError, FormatDecodeError, ParseError, ParserError, UnexpectedElementError, UnknownAttributeError, UnknownElementError
Constant Summary
collapse
- @@parser_factory =
nil
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(host, opt = {}) ⇒ Parser
Returns a new instance of Parser.
52
53
54
55
|
# File 'lib/xsd/xmlparser/parser.rb', line 52
def initialize(host, opt = {})
@host = host
@charset = opt[:charset] || nil
end
|
Instance Attribute Details
Returns the value of attribute charset.
50
51
52
|
# File 'lib/xsd/xmlparser/parser.rb', line 50
def charset
@charset
end
|
Class Method Details
.add_factory(factory) ⇒ Object
41
42
43
44
45
46
|
# File 'lib/xsd/xmlparser/parser.rb', line 41
def self.add_factory(factory)
if $DEBUG
puts "Set #{ factory } as XML processor."
end
@@parser_factory = factory
end
|
.create_parser(host, opt = {}) ⇒ Object
34
35
36
37
38
39
|
# File 'lib/xsd/xmlparser/parser.rb', line 34
def self.create_parser(host, opt = {})
unless @@parser_factory
raise ParserError.new("illegal XML parser configuration")
end
@@parser_factory.new(host, opt)
end
|
30
31
32
|
# File 'lib/xsd/xmlparser/parser.rb', line 30
def self.factory
@@parser_factory
end
|
Instance Method Details
#parse(string_or_readable) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/xsd/xmlparser/parser.rb', line 57
def parse(string_or_readable)
@textbuf = ''
prologue
do_parse(string_or_readable)
epilogue
end
|