Skip to content

Instantly share code, notes, and snippets.

@flou
Created August 12, 2015 09:24
Show Gist options
  • Save flou/cdeceab05a5280012763 to your computer and use it in GitHub Desktop.
Save flou/cdeceab05a5280012763 to your computer and use it in GitHub Desktop.
require "xml/xml"
def payload
%(<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>)
end
doc = XML.parse payload
heading = doc.xpath("/note/heading")
puts heading.class
# => XML::NodeSet
puts heading.length
# => undefined method 'length' for Float64 (compile-time type is (String | Float64 | Bool | XML::NodeSet))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment