w3c / xsdtests

W3C XML Schema 1.1 test suite
17 stars 7 forks source link

Tests with dangling component references #3

Open michaelhkay opened 4 years ago

michaelhkay commented 4 years ago

Both XSD 1.0 and XSD 1.1 say that the absence of a schema component that is referred to by another component does not make the schema invalid (in 1.1, see section 5.3 for a discussion of how validation copes with absent components).

The expected results of this test suite, however, assume that a schema containing unresolved references should always be rejected, even where there are no instance documents to be validated.

michaelhkay commented 4 years ago

Note, Saxon fails 535 of 41536 tests if run with a configuration option that permits dangling references as prescribed in the spec.

brunato commented 4 years ago

If I understood well a schema with dangling references cannot be considered a "strictly assessed" validator (with validation attempted property that has full value).

I run W3C tests on the xmlschema library assuming a strict configuration, so a dangling reference stops the schema parsing and raises an error. I think it could be better to keep this strict setting for W3C tests.

michaelhkay commented 4 years ago

Assessment generally doesn't come into it. Most of these tests assume that the schema is invalid and therefore cannot be used for validation or assessment. In most cases they don't even attempt any validation or assessment; they just expect the schema to be rejected as invalid.

The problem is that these schemas don't violate any of the rules that a valid schema document or schema is required to satisfy; and sections 3.1.3 and 5.3 (XSD 1.1 part 1) make it clear that this is by intent. These sections insist that failure of a QName to resolve does NOT make the schema invalid, it only results in a schema component model in which some components/properties are absent; absent properties may cause instance validation/assessment to be incomplete, but they don't make the schema invalid.

The problem here is that the tests are aligned with common practice in real processors, which DO report such schemas as invalid (for good usability reasons). But the spec says something different. I don't think there's much we can do about it. I experimented trying to change my processor to align with the spec, but I found (a) it caused lots of usability problems, and (b) it caused the tests to fail; so I'm merely recording the fact.