Creating XSD of a XML using Visual studio
I would like to share a simple way to create XSD of a sample Xml file. XSD is a schema document which is used to validate a xml file.
It validates following things:
a. Data type of tags (value of tags)
b. Sequence of tags
c. Parent-child relationship between tags etc.
Sample xml file
1) Open visual studio and create a xml file as per below.
2) Go to XML menu option and click on schema button
3) After clicking on schema option we will have xsd of above sample xml file
4) We can change data type of tags as per below screen.
5) I changed the data type of PRODCUTID tag to integer. And saved it.
6) Now I changed value of PRODUCT ID tag to some string value. It starts validating to created xsd file.
Now as we changed the value of product id, it starts showing error as per below screen.
Creating XSD of XML file is very simple if we follow above steps.