Class: ETL::Parser::SaxParser
- Defined in:
- lib/etl/parser/sax_parser.rb
Overview
ETL parser implementation which uses SAX to parse XML files.
Defined Under Namespace
Classes: Field
Instance Attribute Summary collapse
-
#write_trigger ⇒ Object
The write trigger causes whatever values are currently specified for the row to be returned.
Attributes inherited from Parser
Instance Method Summary collapse
-
#each(&block) ⇒ Object
Returns each row.
-
#fields ⇒ Object
Get an array of Field objects.
-
#initialize(source, options = {}) ⇒ SaxParser
constructor
Initialize the parser *
source
: The Source object *options
: Parser options Hash.
Methods inherited from Parser
Constructor Details
#initialize(source, options = {}) ⇒ SaxParser
Initialize the parser
-
source
: The Source object -
options
: Parser options Hash
17 18 19 20 |
# File 'lib/etl/parser/sax_parser.rb', line 17 def initialize(source, ={}) super configure end |
Instance Attribute Details
#write_trigger ⇒ Object
The write trigger causes whatever values are currently specified for the row to be returned. After returning the values will not be cleared, thus allowing for values which are assigned higher in the XML tree to remain in memory.
12 13 14 |
# File 'lib/etl/parser/sax_parser.rb', line 12 def write_trigger @write_trigger end |
Instance Method Details
#each(&block) ⇒ Object
Returns each row
23 24 25 26 27 28 29 30 |
# File 'lib/etl/parser/sax_parser.rb', line 23 def each(&block) Dir.glob(file).each do |file| parser = REXML::Parsers::SAX2Parser.new(File.new(file)) listener = Listener.new(self, &block) parser.listen(listener) parser.parse end end |
#fields ⇒ Object
Get an array of Field objects
33 34 35 |
# File 'lib/etl/parser/sax_parser.rb', line 33 def fields @fields ||= [] end |