XML Schema XML Tutorial

To specify a  default value, simply include the  default attribute with the desired value: 
 
Fixed values operate much like default values. 
If the attribute is omitted, then the parser inserts the attribute with the fixed value. 
 
Attribute with fixed value

  targetNamespace="http://www.rntsoft.com" xmlns="http://www.rntsoft.com"
  elementFormDefault="qualified">
  
    
      
        
                      use="fixed" value="101" />
          
        
      

    

  

 
File: Data.xml 

        sectionid="101" 
        newspaperid="21"/>
 
Attribute with default value 
The fixed attribute only sets the content if the attribute actually appears in the XML. 
If it is omitted, no content is set.
If the default attribute is set but the attribute is omitted from the XML, then the attribute's value is set to the default value.
File: Schema.xsd

  targetNamespace="http://www.rntsoft.com" xmlns="http://www.rntsoft.com"
  elementFormDefault="qualified">
  
    
      
        
                      use="fixed" value="101" />
                      use="default" value="21" />
        
      

    

  

File: Data.xml