Skip to content

RELAX NG Validator fails to handle XML documents with XML declaration #241

@gemmaro

Description

@gemmaro

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions