`REXML::Document.new` accepts no root input · Issue #289 · ruby/rexml · GitHub
Skip to content

REXML::Document.new accepts no root input #289

Closed

Description

@kou
require "rexml"
REXML::Document.new("") # no error
REXML::Document.new("<?xml version='1.0'?>") # no error

https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-well-formed

[Definition: A textual object is a well-formed XML document if:]

  • Taken as a whole, it matches the production labeled document.
  • It meets all the well-formedness constraints given in this specification.
  • Each of the parsed entities
    which is referenced directly or indirectly within the document is well-formed.

Document

[1] document ::= ( prolog element Misc* ) - ( Char* RestrictedChar Char* )

Should we report an error for no root input?

Activity

  1. naitoh commented on Sep 4, 2025

    @naitoh
    Contributor

    Should we report an error for no root input?

    I think that if there is no root input, an error response should be returned.

  2. kou commented on Sep 5, 2025

    @kou
    MemberAuthor

    OK. Let's validate it.

  3. added 4 commits that reference this issue on Sep 6, 2025
    45a3a55
    183c2fe
    d1eda1b
    bba8b7b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions