ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: fanantoxa@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:81593] [Ruby trunk Bug#13636] REXML::Document.parse_stream doesn't handle when closing tag not provided
Date: Tue, 06 Jun 2017 21:35:39 +0000	[thread overview]
Message-ID: <redmine.issue-13636.20170606213539.ce06f064836fac9b@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13636.20170606213539@ruby-lang.org

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("<body><item>test</item></body>")
xml2 = StringIO.new("<body><item>test</body>")
xml3 = StringIO.new("<body><item>test</item>")

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: "<body><item>test</item>" 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/

       reply	other threads:[~2017-06-06 21:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-13636.20170606213539@ruby-lang.org>
2017-06-06 21:35 ` fanantoxa [this message]
2017-06-06 22:08 ` [ruby-core:81594] [Ruby trunk Bug#13636] REXML::Document.parse_stream doesn't handle when closing tag not provided fanantoxa
2017-06-06 22:35 ` [ruby-core:81595] [Ruby trunk Bug#13636][Assigned] " hsbt
2017-06-07 13:02 ` [ruby-core:81606] [Ruby trunk Bug#13636] " kou
2017-06-30 12:58 ` [ruby-core:81870] " usa
2017-07-23  7:33 ` [ruby-core:82129] " nagachika00

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-13636.20170606213539.ce06f064836fac9b@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).