Skip to content

Instantly share code, notes, and snippets.

@der-flo
Created April 3, 2009 20:23
Show Gist options
  • Save der-flo/89945 to your computer and use it in GitHub Desktop.
Save der-flo/89945 to your computer and use it in GitHub Desktop.
bad rexml
require 'pp'
require 'rexml/document'
test_xml_string = "<tag attr='value&amp;text'></tag>"
pp REXML::Document.new(test_xml_string).root.attributes['attr']
# value&text
parser = REXML::Parsers::BaseParser.new(test_xml_string)
while parser.has_next?
event = parser.pull
next unless event[0] == :start_element
pp event[2]['attr']
# value&amp;text
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment