Module: PoxPaginate::XmlMini::REXML

Defined in:
lib/pox_paginate/xml_mini/rexml.rb

Instance Method Summary collapse

Instance Method Details

#root_node_attributes(xml) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/pox_paginate/xml_mini/rexml.rb', line 4

def root_node_attributes(xml)
  require 'rexml/parsers/sax2parser'
  parser = ::REXML::Parsers::SAX2Parser.new(xml)
  root_attributes = nil
  parser.listen(:start_element) do |uri, localname, qname, attributes|
    root_attributes ||= attributes
  end
  parser.parse
  root_attributes
end