Welcome friends 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 write XS 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 at table to specify data type for attributes right type is equal to excess string I am giving string datatype 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 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.
Exist attribute you can specify various validation for attribute in your exist defile which is the exam l schema definition so this is all about attributes in XML schema thank you.