Module: Moxml::SAX

Defined in:
lib/moxml/sax.rb,
lib/moxml/sax/handler.rb,
lib/moxml/sax/block_handler.rb,
lib/moxml/sax/element_handler.rb

Overview

SAX (Simple API for XML) parsing interface

Provides event-driven XML parsing across all Moxml adapters. SAX parsing is memory-efficient and suitable for processing large XML files.

Examples:

Class-based handler

class MyHandler < Moxml::SAX::Handler
  def on_start_element(name, attributes = {}, namespaces = {})
    puts "Started element: #{name}"
  end
end

context = Moxml.new
context.sax_parse(xml_string, MyHandler.new)

Block-based handler

context.sax_parse(xml_string) do
  start_element { |name, attrs| puts "Element: #{name}" }
  characters { |text| puts "Text: #{text}" }
end

Defined Under Namespace

Classes: BlockHandler, ElementHandler, Handler