Class: AWS::Core::XML::Parser
- Inherits:
-
Object
- Object
- AWS::Core::XML::Parser
- Defined in:
- lib/aws/core/xml/parser.rb
Instance Attribute Summary collapse
-
#rules ⇒ Hash
readonly
Returns the rules for this xml parser that define how it should transform the XMl into Ruby.
Class Method Summary collapse
-
.parse(xml, rules = {}) ⇒ Hash
Returns a hash of parsed xml data.
Instance Method Summary collapse
-
#initialize(rules = {}) ⇒ Parser
constructor
A new instance of Parser.
-
#parse(xml) ⇒ Hash
Returns a hash of parsed xml data.
-
#simulate ⇒ Hash
Returns a hash of mostly empty placeholder data.
Constructor Details
#initialize(rules = {}) ⇒ Parser
Returns a new instance of Parser.
21 22 23 |
# File 'lib/aws/core/xml/parser.rb', line 21 def initialize rules = {} @rules = rules end |
Instance Attribute Details
#rules ⇒ Hash (readonly)
Returns the rules for this xml parser that define how it should transform the XMl into Ruby.
27 28 29 |
# File 'lib/aws/core/xml/parser.rb', line 27 def rules @rules end |
Class Method Details
.parse(xml, rules = {}) ⇒ Hash
Returns a hash of parsed xml data.
45 46 47 |
# File 'lib/aws/core/xml/parser.rb', line 45 def self.parse xml, rules = {} self.new(rules).parse(xml) end |
Instance Method Details
#parse(xml) ⇒ Hash
Returns a hash of parsed xml data.
31 32 33 34 |
# File 'lib/aws/core/xml/parser.rb', line 31 def parse xml xml = '<xml/>' if xml.nil? or xml.empty? sax_handler.parse(xml) end |