Bug #2388
closed
<xs:choice/> accepts empty content as valid
Category:
Schema conformance
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:
Description
An empty choice xs:choice/ should reject all possible content (the content must match at least one branch of the choice, and if there are no branches, it cannot do so). But Saxon appears to accept an empty element as a valid instance of the empty choice xs:choice/.
- Status changed from New to In Progress
I traced this to a problem in the spec, in the definition of "emptiable". The spec leads to the conclusion that xs:choice/ is emptiable (that is, an empty sequence is a valid instance), but it is not. Saxon uses the fact that the content is emptiable to conclude in this case that the only legal content is an empty sequence; it then optimizes away the element-only content model and the finite state machine by setting variety="EMPTY". I've patched it by refining this test so that we don't set variety=EMPTY when the content model is an empty choice. The patch fixes this case, though we need to check for side-effects.
- Status changed from In Progress to Resolved
The change appears to cause no problems with the test suite.
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in version set to 9.6.0.6
Bug fix applied in the Saxon 9.6.0.6 maintenance release.
- Sprint/Milestone set to 9.6.0.6
- Applies to branch 9.6 added
- Fix Committed on Branch 9.6 added
- Fixed in Maintenance Release 9.6.0.6 added
Please register to edit this issue
Also available in: Atom
PDF