Repository navigation
Conversation
Author
|
The Test workflow currently reports This follow-up was prepared with Codex. |
bardrop
reviewed
Nov 18, 2026
Documents with XML declarations fail RELAX NG validation on
:xmldecl. The multiline example in #241 also emits whitespace before and after the root, which the validator incorrectly treats as element content.Handle the declaration and root-external XML whitespace in
RelaxNG#receive. Skip comments, processing instructions, and DTD declarations so markup before, inside, or after the root does not advance the schema. Use the existing attribute stack to identify element nesting, initialize it for validation without an initialreset, and retain its existing reset behavior. Whitespace inside elements still reaches schema validation, includingtextand exactvaluepatterns. The sharedValidatoris unchanged.Fixes #241.
Regressions preserve the issue's original schema and multiline document verbatim, and cover declaration variants, string and IO sources, leading/trailing whitespace with and without declarations, first use without reset, repeated resets, and resetting an unfinished document. They also check that incorrect roots/children, missing required children, mismatched text values, and non-XML whitespace outside the root are rejected.
Validation on macOS arm64 / Ruby 3.4.9:
3ed87beand pass on1a90d7c. The current targeted suite passes all 34 tests and 218 assertions.bundle exec rake test: 852 tests, 2744 assertions, no failures/errors, 5 omissions.bundle exec rake test RUBYOPT=--enable-frozen-string-literal: the same result.bundle exec rake warning:error clobber_rdoc rdocandgit diff --check: pass.The five omissions are the repository's Ruby < 4.0 Ractor exclusions. Bundler 2.6.9 required
BUNDLE_DISABLE_EXEC_LOAD=truefor this non-ASCII installation path. Other Ruby versions and the Linux/Windows/JRuby matrix have not been run locally.AI assistance: OpenAI Codex generated the implementation, tests and this description, and ran the listed checks. No human review is claimed.