An open API service indexing awesome lists of open source software.

https://github.com/threez/simple-xml

Some helpers for REXML::Element to create hashes from xml easily
https://github.com/threez/simple-xml

Last synced: about 1 year ago
JSON representation

Some helpers for REXML::Element to create hashes from xml easily

Awesome Lists containing this 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:

```ruby
doc = REXML::Document.new(%Q{


Deutschland
76135
Karlsruhe

Ernst-Frey-Str. 10


}
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" }
```