Module: AwsSdb::Response

Defined in:
lib/aws_sdb_bare/response.rb

Defined Under Namespace

Modules: XmlUtils Classes: Base, DomainMetadata, GetAttributes, ListDomains, Metadata, Query, QueryWithAttributes, Select, UnknownResponse

Constant Summary collapse

MEMBERS =
{}

Class Method Summary collapse

Class Method Details

.parse(doc) ⇒ Object

returns an instance of the response, the class of the response is determined by the response content



12
13
14
15
16
17
18
19
20
21
# File 'lib/aws_sdb_bare/response.rb', line 12

def self.parse(doc)
  @@parser ||= Hpricot if defined?(Hpricot)
  @@parser ||= Nokogiri if defined?(Nokogiri)
  parsed_doc = @@parser.XML(doc)
  begin
    MEMBERS[parsed_doc.root.name].new(parsed_doc)
  rescue
    raise UnknownResponse, "unknown response #{doc.inspect}"
  end
end