1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
# frozen_string_literal: true
require 'nokogiri'
module Aws
module Xml
class Parser
class NokogiriEngine
def initialize(stack)
@stack = stack
end
def parse(xml)
Nokogiri::XML::SAX::Parser.new(self).parse(xml)
end
def xmldecl(*args); end
def start_document; end
def end_document; end
def comment(*args); end
def start_element_namespace(element_name, attributes = [], *ignored)
@stack.start_element(element_name)
attributes.each do |attr|
name = attr.localname
name = "#{attr.prefix}:#{name}" if attr.prefix
@stack.attr(name, attr.value)
end
end
def characters(chars)
@stack.text(chars)
end
def end_element_namespace(*ignored)
@stack.end_element
end
def error(msg)
@stack.error(msg)
end
end
end
end
end
|