
XML Schemas • 187
4.6 ATTRIBUTES
So far, we have ignored attributes in the context of schemas. We would now take a look at them. The
declaration of attributes is similar to that of elements. We specify the keyword called as attribute to define an
attribute. For example, suppose that we want to declare an attribute named designation. Then, its declaration
would be as follows:
<attribute name = “designation”/>
We can also add a data type to an attribute. For example, the above declaration can be modified as follows:
<attribute name = “designation” type = “xsd:string”/>
An attribute occurs only once, so we cannot use minOccurs or maxOccurs. However, ...