Class: XMLScan::XMLProcessor

Inherits:
Object
  • Object
show all
Includes:
ElementProcessor
Defined in:
lib/xmlscan/processor.rb

Constant Summary

Constants included from ElementProcessor

ElementProcessor::MY_METHODS, ElementProcessor::SKIP

Class Method Summary collapse

Methods included from ElementProcessor

#initialize

Methods included from Visitor

#on_attr_charref, #on_attr_charref_hex, #on_attr_entityref, #on_attr_value, #on_attribute, #on_attribute_end, #on_cdata, #on_chardata, #on_charref, #on_charref_hex, #on_comment, #on_doctype, #on_end_document, #on_entityref, #on_etag, #on_pi, #on_prolog_space, #on_stag, #on_stag_end, #on_stag_end_empty, #on_start_document, #on_xmldecl, #on_xmldecl_encoding, #on_xmldecl_end, #on_xmldecl_key, #on_xmldecl_other, #on_xmldecl_standalone, #on_xmldecl_version, #parse_error, #valid_error, #warning, #wellformed_error

Class Method Details

.process(io, opts = {}, mod = nil) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/xmlscan/processor.rb', line 41

def self.process(io, opts={}, mod=nil)
  mod ||= ElementProcessing
  STDERR << "process #{io.inspect}, #{opts.inspect}\n"
  io = case io
      when IO, StringIO; io
      when String; open(io)
      else raise "bad type file input #{io.inspect}"
    end

  visitor = new(opts, mod)
  visitor.parser.parse(io)
  visitor.pairs
end