Skip to content

Instantly share code, notes, and snippets.



Created Dec 10, 2008
What would you like to do?
<?xml version="1.0" encoding="utf-8"?>
<rsp stat="fail">
<err code="11" msg="Something bad happened" />
require 'rubygems'
require 'happymapper'
require 'pp'
class Error
include HappyMapper
attribute :code, Integer
attribute :message, String
class Rsp
include HappyMapper
# NOTE: tag "/rsp" helps, but doesn't seem necessary
attribute :stat, String
element :err, Error
error ="error.xml")
pp Rsp.parse(error) # => []
pp Rsp.parse(error, :single => true) # => nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.