class AWS::Core::XML::Parser
def self.parse xml, rules = {}
-
(Hash)
- Returns a hash of parsed xml data.
Parameters:
-
rules
(Hash
) -- A has of xml parsing rules. Generally -
xml
(String
) -- An XML document string to parse.
def self.parse xml, rules = {} self.new(rules).parse(xml) end
def initialize rules = {}
-
rules
(Hash
) -- A has of xml parsing rules. Generally
def initialize rules = {} @rules = rules end
def parse xml
-
(Hash)
- Returns a hash of parsed xml data.
Parameters:
-
xml
(String
) -- An XML document string to parse.
def parse xml xml = '<xml/>' if xml.nil? or xml.empty? sax_handler.parse(xml) end
def sax_handler
we express a gem dependency on is nokogiri.
Currently you can not choose your xml sax handler, and the only
extension.
is the only library that does not rely on a native
by libxml-ruby. Lastly (by a long shot) is REXML. REXML
There are three handlers, nokogiri is the fastest, followed
def sax_handler begin SaxHandlers::Nokogiri.new(rules) rescue NameError, LoadError SaxHandlers::REXML.new(rules) end end
def simulate
-
(Hash)
- Returns a hash of mostly empty placeholder data.
def simulate XML::Stub.simulate(rules) end