Default and Fixed Values : default « XML Schema « XML Tutorial






In XML Schemas, you can declare default and fixed values for elements as well as attributes. 
When declaring default values for elements, you can specify only a text value. 
To specify a default value, simply include the default attribute with the desired value. 

<element name="last" type="string" default="Doe"/> 

<last></last> or <last/> then it would treat the element as: <last>Doe</last> 

If the element does not appear within the document or if the element already has content, 
then the default value is not used. 

When an element's value can never change, simply include a fixedattribute with the fixed value. 

<element name="version" type="string" fixed="1.0"/>








3.87.default
3.87.1.Default and Fixed Values
3.87.2.You may not set both the default and fixed attributes at the same time