class Aws::Xml::Parser::LibxmlEngine
Public Class Methods
new(stack)
click to toggle source
# File lib/aws-sdk-core/xml/parser/libxml_engine.rb, line 12 def initialize(stack) @stack = stack end
Public Instance Methods
on_characters(chars)
click to toggle source
# File lib/aws-sdk-core/xml/parser/libxml_engine.rb, line 42 def on_characters(chars) @stack.text(chars) end
on_end_element_ns(*ignored)
click to toggle source
# File lib/aws-sdk-core/xml/parser/libxml_engine.rb, line 38 def on_end_element_ns(*ignored) @stack.end_element end
on_error(msg)
click to toggle source
# File lib/aws-sdk-core/xml/parser/libxml_engine.rb, line 46 def on_error(msg) @stack.error(msg) end
on_start_element_ns(element_name, attributes, prefix = nil, uri = nil, ns = {})
click to toggle source
# File lib/aws-sdk-core/xml/parser/libxml_engine.rb, line 22 def on_start_element_ns(element_name, attributes, prefix = nil, uri = nil, ns = {}) # libxml-ruby does not provide a mapping from element attribute # names to their qname prefixes. The following code line assumes # that if a attribute ns is defined it applies to all attributes. # This is necessary to support parsing S3 Object ACL Grantees. # qnames are not used by any other AWS attribute. Also, new # services are using JSON, limiting the possible blast radius # of this patch. attr_ns_prefix = ns.keys.first @stack.start_element(element_name) attributes.each do |attr_name, attr_value| attr_name = "#{attr_ns_prefix}:#{attr_name}" if attr_ns_prefix @stack.attr(attr_name, attr_value) end end
parse(xml)
click to toggle source
# File lib/aws-sdk-core/xml/parser/libxml_engine.rb, line 16 def parse(xml) parser = ::LibXML::XML::SaxParser.string(xml) parser.callbacks = self parser.parse end