Project

Profile

Help

Bug #2388

closed

<xs:choice/> accepts empty content as valid

Added by Michael Kay almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Schema conformance
Sprint/Milestone:
Start date:
2015-06-02
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:
Platforms:

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/.

Actions #1

Updated by Michael Kay almost 9 years ago

  • 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.

Actions #2

Updated by Michael Kay almost 9 years ago

  • Status changed from In Progress to Resolved

The change appears to cause no problems with the test suite.

Actions #3

Updated by O'Neil Delpratt almost 9 years ago

  • 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.

Actions #4

Updated by O'Neil Delpratt over 8 years ago

  • 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