Module: MultiXML::Parsers::SaxHandler Private

Included in:
LibxmlSax::Handler, NokogiriSax::Handler
Defined in:
lib/multi_xml/parsers/sax_handler.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Shared SAX handler logic for building hash trees from XML events.

Provides a stack machine used by both NokogiriSax and LibxmlSax handlers. Parser-specific subclasses translate their native callbacks into calls on this entrypoint:

  • handle_start_element_ns(local, prefix, attr_tuples, ns_decls) where attr_tuples = [[attr_prefix_or_nil, local, value], ...] ns_decls = [[prefix_or_nil, uri], ...]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resultHash (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get the parsed result

Returns:

  • (Hash)

    the parsed hash



33
34
35
# File 'lib/multi_xml/parsers/sax_handler.rb', line 33

def result
  @result
end

Instance Method Details

#initialize_handler(mode) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Initialize the handler state

Parameters:

  • mode (Symbol)

    Namespace handling mode



22
23
24
25
26
27
# File 'lib/multi_xml/parsers/sax_handler.rb', line 22

def initialize_handler(mode)
  @mode = mode
  @result = {}
  @stack = [@result]
  @pending = []
end