Class: FlameChannelParser::XMLParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/xml_parser.rb

Defined Under Namespace

Classes: XMLToSetup

Constant Summary

Constants inherited from Parser

Parser::BASE_VALUE_MATCHER, Parser::CHANNEL_MATCHER, Parser::EXTRAP_MATCHER, Parser::KF_COUNT_MATCHER, Parser::LITERALS, Parser::NODE_NAME_MATCHER, Parser::NODE_TYPE_MATCHER

Instance Attribute Summary

Attributes inherited from Parser

#logger_proc

Instance Method Summary collapse

Methods inherited from Parser

#channel_is_useful?, #extract_key_from, #key_matchers, #log, #parse_channel, #symbolize_literal

Instance Method Details

#parse(io) ⇒ Object

Parses the setup passed in the IO. If a block is given to the method it will yield Channel objects one by one instead of accumulating them into an array (useful for big setups)



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/xml_parser.rb', line 76

def parse(io)
  # Ok this is gothic BUT needed. What we do is we transform the XML setup into the OLD
  # setup format, after which we run it through the OLD parser all the same.
  # I am almost sure that ADSK does the same.
  t = Tempfile.new("bx")
  REXML::Document.parse_stream(io, XMLToSetup.new(t))
  t.rewind
  if block_given?
    super(t, &Proc.new)
  else
    super(t)
  end
end