Element-Mandatory Attribute declaration in XSD Schema:

后端 未结 4 1570
故里飘歌
故里飘歌 2021-02-19 15:46

I want to declare an element to be included in a complex type declaration, and the element has a mandatory attribute: \"option=MyOption\", but the value of the \"option\

4条回答
  •  滥情空心
    2021-02-19 16:45

    1) This is a simple required string attribute

    
        
            
                
                    
                
            
        
     
    

    2) To require exactly one of a list of allowed values:

    
        
            
                
                    
                          
                              
                                  
                                  
                              
                          
                      
                
            
        
     
    

    3) One can use a range as a restriction, like in the example below.

    
        
            
                
                    
                          
                              
                                  
                                  
                              
                          
                      
                
            
        
     
    

    4) Below, the attribute is declared as a list containing decimal values. This allows an attribute to contain a subset of the specified values, e.g. Option="6 77 95".

      
          
              
              
              
              
          
      
    
        
            
                
                    
                          
                              
                          
                      
                
            
        
     
    

    5) Here the attribute is declared optional, but provided with a default value ("test"), which is sometimes sufficient:

    
        
            
                
                    
                
            
        
     
    

提交回复
热议问题