Skip to content

Instantly share code, notes, and snippets.

@jcromartie
Created May 8, 2013 16:41
Show Gist options
  • Save jcromartie/5541754 to your computer and use it in GitHub Desktop.
Save jcromartie/5541754 to your computer and use it in GitHub Desktop.
SAX Machine/Nokogiri attribute decoding???
require 'sax-machine'
class Foo
include SAXMachine
attribute :bar
end
class FooDoc
include SAXMachine
elements :foo, :as => :foos, :class => Foo
end
puts "expecting: bat & baz"
puts FooDoc.parse("<doc><foo bar='bat &amp; baz'></foo></doc>").foos.first.bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment