JiBX
  1. JiBX
  2. JIBX-164

Enforce proper cardinality for xsd:choice particles -- one and only one should be tolerated

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JiBX 1.1.4
    • Fix Version/s: JiBX 1.2
    • Component/s: core
    • Labels:
      None
    • Environment:
      N/A
    • Number of attachments :
      0

      Description

      Per the following discussion thread on the JiBX-users list

      Tryng to bind xsd:choice – JiBX requires each choice to be present
      http://thread.gmane.org/gmane.comp.java.jibx.users/947

      the current implementation of xsd:choice handling via the "choice=true" qualifier misses an important constraint on xsd:choice particles: exactly one of the choice values must be provided in a valid document instance. At present JiBX forces the mapping to note each choice value as optional ("usage=optional"), and in fact permits all the constituent values to be optional, accepting zero of them being present in an instance document as valid. JiBX should enforce that one and only one choice value is provided for each "choice=true"-qualified structure.

      While on this topic, it's confusing to the mapping author to have to specify "usage=optional" in addition to the "choice=true" qualifier. The optional implication isn't really what's intended here. We're trying to say "one and only one of these", not that "some or all of these are optional". Toward that, I suggest either introducing a "choice" element or at least dropping the requirement to specify "optional=true" on each of the constituent choice values.

        Activity

        Hide
        Dennis Sosnoski added a comment -

        Eliminated the requirement for usage="optional" some time ago, and current choice handling does check for one and only one instance present.

        Show
        Dennis Sosnoski added a comment - Eliminated the requirement for usage="optional" some time ago, and current choice handling does check for one and only one instance present.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Steven E. Harris
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: