Welcome parents in this video tutorial we will learn how to define attribute in XML schema definition of XML documents attribute so now let’s define one attribute for body element which is the children element I am defying language is equal to English I have defined one attribute for body is language and I have given value English now in schema.
Definition to give attribute validation we can use XML schema attributes so in the complex type right exists attribute now you have to give for which you.
Are specifying attribute I am specifying attribute for body so right body and then what are you.
Specifying what is the attribute my attribute name is length so I am writing length which is the language and then you can specify various option now you.
Can also specify data types for attribute to specify data type for attributes read type is equal to excess string I am giving string data type for my attributes now there are various options are available for example you can give default value for attribute you can fix the value of attribute or you can make attributes optional or required let’s see what is the procedure.
For example if I want to make my default attribute to Hindi then I have to write default is equal to default value of attribute if I want to fix the value of attribute then I have to write fixed in place of default so if I write fixed is equal to Hindi then default attribute will be Hindi and then if you want to specify attribute is optional then right he use is equal to optional when you are using these use you cannot use fixed or default attribute so I am.
Using use is equal to optional then you can either specify attribute or not now if I use required then I must have to specify attribute in the XML document after writing any option close the attribute tag which is exist attribute so using the XS attribute you can specify various validation for attribute in your existing file which is the exam l schema definition.
So this is all about attributes in XML schema thank you..