Condition based on attribute value (XML Schema)

后端 未结 1 1118
梦谈多话
梦谈多话 2021-02-05 14:21

Is it possible to define in XML Schema an condition based on attribute value? For example, when test@attrib=\"one\", I want one-element to be allowed a

1条回答
  •  日久生厌
    2021-02-05 14:58

    Not within the same type. You would need to define a different type for each of the different options.

    UPDATE

    To re-use type definitions in your schema:

    
    
    
      
        
          
            
            
          
        
      
    
      
      
        
          
          
          
          
        
        
      
    
      
        
          
          
          
          
        
        
      
    
      
      
      
      
      
      
    
    
    

    This will validate:

    
    
      
        sadas
        sadas
        sadas
        sadas
      
    
    

    and

    
    
      
        sadas
        sadas
        sadas
        sadas
      
    
    

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