Parsing XML using Nokogiri and ActiveSupport - mnishiguchi/physical_property_parser GitHub Wiki

1. Converting raw XML into Nokogiri document

xml_doc = Nokogiri::XML(raw_xml)

2. Splitting the Nokogiri document into nodes

xml_doc.xpath("PhysicalProperty/Property") # using xpath
xml_doc.css("PhysicalProperty Property")   # using css

3. Converting a nokogiri node to a string then to a Ruby hash

Hash.from_xml

hash = Hash.from_xml(xml_node.to_s)