Any difference when you use min/maxOccurs at sequence rather than element level

后端 未结 1 1419
天涯浪人
天涯浪人 2021-02-08 11:02

What I mean is are there any situations where this:


    
        
            

        
1条回答
  •  悲哀的现实
    2021-02-08 11:31

    Generally speaking occurrence constraints (minOccurs or maxOccurs) on element groups (sequences or choices) mean that the whole group can be repeated whereas occurrence constraints on elements mean that the element can be repeated before the next element in the group appears.

    If your sequence contains only one element, there is no difference.

    
        ...
    
    

    is equal to

    
        ...
    
    

    and they both allow repeating the element . There will be a difference as soon as the sequence contains more than one element definition.

    
        ...
        ...
    
    

    is not equal to

    
        ...
        ...
    
    

    The first one allows structures like

    
    
    
    
    

    but the second one doesn't allow such a structure. Instead it allows structures like

    
    
    
    
    

    which on the other hand are not allowed by the first definition.

    0 讨论(0)
提交回复
热议问题