Project

simple-xml

0.0
No commit activity in last 3 years
No release in over 3 years
Some helpers for REXML::Element to create hashes from xml easily.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
 Project Readme

SimpleXML

A simple add on to rexml to parse xml data simply by converting them to a hash. That hash can than easily be passed to model objects to validate etc.

Example usage:

doc = REXML::Document.new(%Q{
     <?xml version="1.0"?>
     <address>
       <country iso_code="de" nationality="deutsch">Deutschland</country>
       <zip_code>76135</zip_code>
       <city>Karlsruhe</city>
       <street>
         <name_and_number>Ernst-Frey-Str. 10</name_and_number>
       </street>
     </address>
   }
doc.simplify("/address") #=> { :country => "Deutschland", :zip_code => "76135", :city => "Karlsruhe", :street => { :name_and_number => "Ernst-Frey-Str. 10" } }
doc.simplify_attributes("/address/country") #=> { :iso_code => "de", :nationality => "deutsch" }