[xml] possible bug in RELAX NG validator



Hi,

RELAX NG validation with xmllint (libxml version 20705) gives incorrect
results when faced with the following invalid schema:

== file: optroot.rng ==
<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0";
         ns="http://example.com/foo";>
  <start>
    <optional>
      <element name="foo">
        <element name="bar">
          <empty/>
        </element>
      </element>
    </optional>
  </start>
</grammar>

The schema is invalid because the document element "foo" is optional -
start//empty path is prohibited in sec. 10.2.6 of the RELAX NG spec.
However, xmllint doesn't report an error but instead successfully
validates the following document with extra bogus content:

== file: optroot.xml ==
<?xml version="1.0"?>
<foo:foo xmlns:foo="http://example.com/foo";>
  <foo:bar/>
  <foo:baz/>
</foo:foo>

$ xmllint --noout --relaxng optroot.rng optroot.xml
optroot.xml validates

Jing does the right thing:

$ jing optroot.rng optroot.xml
error: "start" contains "empty"

Regards, Lada

-- 
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]