Skip to content

Conversation

dalibor
Copy link
Contributor

@dalibor dalibor commented Aug 26, 2025

Fixes #43

With REXML 3.4.2, REXML::Document.new raises an error if a <!DOCTYPE> declaration is present but no root element has been defined.

rexml-3.4.2/lib/rexml/source.rb:275:in 'REXML::IOSource#read_until': undefined method 'eof?' for nil (NoMethodError)

        read if @scanner.eos? and [email protected]?

@jessebs jessebs merged commit c15e846 into jessebs:main Aug 27, 2025
8 checks passed
@jessebs
Copy link
Owner

jessebs commented Aug 27, 2025

Thank you for the quick fix!

@kou
Copy link

kou commented Aug 27, 2025

This is a correct fix (as a REXML maintainer view).

In this case, REXML::Document.new raises a non-expected error but REXML::Document.new must reject invalid XML. In this case, no root element XML is an invalid XML.

@btihen
Copy link

btihen commented Aug 27, 2025

Cool - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed test with rexml 3.4.2
4 participants