Forum: Ruby Cobra vs Mongoose 0.0.1

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2abf5beb51d5d66211d525a72c5cb39d?d=identicon&s=25 Paul Battley (Guest)
on 2006-04-17 00:31
(Received via mailing list)
Cobra vs Mongoose translates XML to and from Ruby Hash objects,
following the BadgerFish (http://badgerfish.ning.com/) convention.

Usage

Converting XML to a Ruby Hash

require 'cobravsmongoose'
xml = '<alice><bob>charlie</bob><bob>david</bob></alice>'
CobraVsMongoose.xml_to_hash(xml)
# => { "alice" => { "bob" => [{ "$" => "charlie" }, { "$" => "david" }]
} }

Converting a Ruby Hash to XML

require 'cobravsmongoose'
hash = { "alice" => { "$" => "bob", "@charlie" => "david" } }
CobraVsMongoose.hash_to_xml(hash)
# => "<alice charlie='david'>bob</alice>"

More information is available on the RubyForge page:
http://cobravsmongoose.rubyforge.org/

Paul.
This topic is locked and can not be replied to.