From: fanantoxa@... Date: 2017-06-06T21:35:39+00:00 Subject: [ruby-core:81593] [Ruby trunk Bug#13636] REXML::Document.parse_stream doesn't handle when closing tag not provided Issue #13636 has been reported by fanantoxa (Anton Sivakov). ---------------------------------------- Bug #13636: REXML::Document.parse_stream doesn't handle when closing tag not provided https://bugs.ruby-lang.org/issues/13636 * Author: fanantoxa (Anton Sivakov) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux] * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- I've tried to use REXML for parsing but got unexpected behavior: Here is example: ~~~ ruby require 'rexml/document' require 'rexml/streamlistener' class Handler include REXML::StreamListener end xml1 = StringIO.new("test") xml2 = StringIO.new("test") xml3 = StringIO.new("test") handler = Handler.new REXML::Document.parse_stream(xml1, handler) # => nil REXML::Document.parse_stream(xml2, handler) # => REXML::ParseException: Missing end tag for 'item' (got "body") REXML::Document.parse_stream(xml3, handler) # => nil ~~~ Actualy XML: "test" is broken so it's expected to get: ~~~ ruby REXML::ParseException.new( "Missing end tag for body") ~~~ I can't rely on REXML parse since I'm not getting exception when XML data structure not valid. -- https://bugs.ruby-lang.org/ Unsubscribe: