From: Frank Reiff Date: 2007-12-08T03:12:27+09:00 Subject: REXML: parsing a string with unescaped ampersand entities Hi, REXML seems to SOMETIMES choke on parsing ampersands within entities, e.g. string = 'hello&world' doc = Document.new(string) puts "#{doc}" works fine (output below): hello&world BUT: string = 'hello& world' doc = Document.new(string) puts "#{doc}" crashes out with: REXML::ParseException: # /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/text.rb:91:in ‘initialize’ /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/treeparser.rb:43:in `new' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/treeparser.rb:43:in `parse' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:190:in `build' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:45:in `initialize' /Users/frankreiff/Live Developments/ruby/analyze/xml_parser.rb:102:in `new' /Users/frankreiff/Live Developments/ruby/analyze/xml_parser.rb:102 ... Illegal character '&' in raw string "hello& world" Line: Position: Last 80 unconsumed characters: The difference is the space after the & What is going on? and how can I fix this? Best regards, Frank -- Posted via http://www.ruby-forum.com/.