XSD allow attribute only depending on other attribute value

前端 未结 1 1728
攒了一身酷
攒了一身酷 2021-01-20 03:07

Suppose I have an XML element, food, that can take on one of two forms:




        
1条回答
  •  悲哀的现实
    2021-01-20 03:55

    You can do this using XSD 1.1's Conditional Type Assignment:

    
     
      
         
        
      
      
        
          
        
      
      
        
          
        
        
      
    
    

    Do consider, however, an alternative design that's expressible in both XSD 1.1 and 1.0 that's generally preferable:

    
    
    

    That is, rather than have a kind attribute, use the element name to convey kind.

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