Created
August 12, 2015 09:24
-
-
Save flou/cdeceab05a5280012763 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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