Class: XSD::XMLParser::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/action_web_service/xsd/xmlparser/parser.rb

Direct Known Subclasses

REXMLParser, XMLParser, XMLScanner

Defined Under Namespace

Classes: ElementConstraintError, FormatDecodeError, ParseError, 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.



47
48
49
50
# File 'lib/action_web_service/xsd/xmlparser/parser.rb', line 47

def initialize(host, opt = {})
  @host = host
  @charset = opt[:charset] || nil
end

Instance Attribute Details

#charsetObject

Returns the value of attribute charset.



45
46
47
# File 'lib/action_web_service/xsd/xmlparser/parser.rb', line 45

def charset
  @charset
end

Class Method Details

.add_factory(factory) ⇒ Object



36
37
38
39
40
41
# File 'lib/action_web_service/xsd/xmlparser/parser.rb', line 36

def self.add_factory(factory)
  if $DEBUG
    puts "Set #{ factory } as XML processor."
  end
  @@parser_factory = factory
end

.create_parser(host, opt = {}) ⇒ Object



32
33
34
# File 'lib/action_web_service/xsd/xmlparser/parser.rb', line 32

def self.create_parser(host, opt = {})
  @@parser_factory.new(host, opt)
end

.factoryObject



28
29
30
# File 'lib/action_web_service/xsd/xmlparser/parser.rb', line 28

def self.factory
  @@parser_factory
end

Instance Method Details

#parse(string_or_readable) ⇒ Object



52
53
54
55
56
57
# File 'lib/action_web_service/xsd/xmlparser/parser.rb', line 52

def parse(string_or_readable)
  @textbuf = ''
  prologue
  do_parse(string_or_readable)
  epilogue
end