XSD Simple Types-XSD Attribute - XSD

What is the use of XSD Attribute?

Attribute represents the attribute of an XML element and XSD defines it as a simple type.



Name of the Attribute. For example,

defines following rollno attribute which can be used in an XML element. For example


Type of the Attribute. For example,

defines type of attribute as integer, rollno should have value of type int.


Consider below XML Element

XSD declarations for rollno attribute will be as follows

Default Value

Attribute can have a default value assigned to it. Default value is used in case the attribute has no value.

Fixed Value

Attribute can have a fix value assigned. In case a fixed value is assigned, then the element cannot have any value.


Attributes are by default optional. But to make an attribute mandatory, "use" attribute can be used.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

XSD Topics