XML schema construct for “any one or more of these elements but must be at least one”

后端 未结 3 1915
-上瘾入骨i
-上瘾入骨i 2020-12-03 17:06

I\'m trying to set up part of a schema that\'s like a \"Sequence\" where all child elements are optional, but at least one of the elements must be present,

3条回答
  •  时光说笑
    2020-12-03 17:44

    Try this:

    
      
        
        
        
      
      
        
        
      
      
    
    

    Doing so, you force either to choose the first element and then the rest is optional, either the second element and the rest is optional, either the third element.

    This should do what you want, I hope.

    Of course, you could place the sub-sequences into groups, to avoid to duplicate an element in each sequence if you realize you miss one.

提交回复
热议问题