Skip to content

Instantly share code, notes, and snippets.

@djberg96
Created July 31, 2015 16:00
Show Gist options
  • Save djberg96/2250dbb30effb4ea4899 to your computer and use it in GitHub Desktop.
Save djberg96/2250dbb30effb4ea4899 to your computer and use it in GitHub Desktop.
require 'rexml/document'
require 'nokogiri'
str = %Q{<a><b/><c id="1"/><c id="2"/><d/></a> }
rdoc = REXML::Document.new(str)
p rdoc.root.elements
p rdoc.root.elements['c'] # Works
ndoc = Nokogiri::XML::Document.parse(str)
p rdoc.root.elements
p ndoc.root.elements['c'] # Boom!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment