ruby / ruby/rexml

RELAX NG Validator fails to handle XML documents with XML declaration

Open
#241 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
182
Forks
99
Avg merge
2d 23h
Merged PRs (30d)
8

Description

The RELAX NG validator currently does not handle XML documents with an XML declaration, such as <?xml version="1.0" encoding="UTF-8"?>.

As a first step to address this issue, I suggest adding the following test case to test/test_validation_rng.rb. This test case checks that the validator can successfully validate an XML document with a declaration. I haven't yet developed an implementation solution, but this test will help ensure that we cover this scenario:

def test_document_with_declaration
  rng = <<-XML
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="root"/>
  </start>
</grammar>
XML
  validator = REXML::Validation::RelaxNG.new(rng)

  source = <<-XML
<?xml version="1.0" encoding="UTF-8"?>
<root/>
XML

  no_error(validator, source)
end

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed test case in test/test_validation_rng.rb and run the RELAX NG validation tests. Confirm that an XML document containing the declaration validates successfully against the provided grammar; the implementation path is not specified in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.