Module: HBase::XmlDecoder

Included in:
HTable, Scanner
Defined in:
lib/mandy/ruby-hbase/xml_decoder.rb

Instance Method Summary collapse

Instance Method Details

#parse_row_result(xml) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/mandy/ruby-hbase/xml_decoder.rb', line 3

def parse_row_result(xml)
  doc = XML::Parser.string(xml).parse

  name_node = doc.root.find_first("/row/name")
  name = name_node ? name_node.content.strip : nil
  
  values = {}
  
  doc.find("/row/columns/column").each do |node|
    values[node.find_first("name").content.strip.unpack('m').first] = node.find_first("value").content.strip.unpack("m").first
  end
  
  [name, values]
end