Sha256: 5ccd3e464d779345eba6e2caa797cfc5ee0e3751889ecce8a41c540ca566d11b

Contents?: true

Size: 659 Bytes

Versions: 3

Compression:

Stored size: 659 Bytes

Contents

require 'sax-machine/handlers/sax_abstract_handler'
require 'nokogiri'

module SAXMachine
  class SAXNokogiriHandler < Nokogiri::XML::SAX::Document
    include SAXAbstractHandler

    def sax_parse(xml_input)
      parser = Nokogiri::XML::SAX::Parser.new(self)
      parser.parse(xml_input) do |ctx|
        ctx.replace_entities = true
      end
    end

    alias_method :initialize, :_initialize
    alias_method :characters, :_characters
    alias_method :cdata_block, :_characters
    alias_method :start_element, :_start_element
    alias_method :end_element, :_end_element
    alias_method :error, :_error
    alias_method :warning, :_warning
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sax-machine-1.3.2 lib/sax-machine/handlers/sax_nokogiri_handler.rb
sax-machine-1.3.1 lib/sax-machine/handlers/sax_nokogiri_handler.rb
sax-machine-1.3.0 lib/sax-machine/handlers/sax_nokogiri_handler.rb