---
title: "Creating XSD of a XML using Visual studio"  
description: "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."  
author: "Devesh Omar"  
published: 2014-05-19  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/1400/creating-xsd-of-a-xml-using-visual-studio  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# Creating XSD of a XML using Visual studio

##### Introduction

I would like to share a simple way to create XSD of a sample [Xml file](https://www.mindstick.com/articles/75/how-to-read-and-write-xml-file-through-c-sharp). XSD is a

schema [document](https://www.mindstick.com/articles/328642/what-to-consider-while-choosing-a-software-documentation-tool) which is used to [validate](https://www.mindstick.com/forum/1490/what-is-better-solution-for-validate-form-textboxs-value) a xml file.

It validates following things:

a. Data type of tags (value of tags)

b. [Sequence](https://www.mindstick.com/interview/34504/difference-between-identity-vs-sequence) of tags

c. Parent-child [relationship](https://www.mindstick.com/articles/54917/how-to-keep-her-happy-in-a-long-distance-relationship) between tags etc.

##### Sample xml file

```
<?xml version="1.0"?><ORDERDETAILS><ORDER><ORDERID>1234</ORDERID><PRODUCTID>0090</PRODUCTID><ORDERDATE>23-07-2013</ORDERDATE><CUSTOMERID>x4564<CUSTOMERID></ORDER><ORDER><ORDERID>1235</ORDERID><PRODUCTID>0030</PRODUCTID><ORDERDATE>23-07-2013</ORDERDATE><CUSTOMERID>x4334<CUSTOMERID></ORDER></ORDERDETAILS>
```

Steps

1) Open [visual studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available) and create a xml file as per below.

\
![Creating XSD of a XML using Visual studio](http://www.mindstick.com/MindStickArticle/928e8043-b6b9-4f48-9bb0-34e65164134a/Images/image001.png)\

2) Go to XML menu option and click on schema button

\
![Creating XSD of a XML using Visual studio](http://www.mindstick.com/MindStickArticle/928e8043-b6b9-4f48-9bb0-34e65164134a/Images/image002.png)

\

3) After clicking on schema option we will have xsd of above sample xml file

\
![Creating XSD of a XML using Visual studio](http://www.mindstick.com/MindStickArticle/928e8043-b6b9-4f48-9bb0-34e65164134a/Images/image004.png)

\
4) We can change data type of tags as per below screen.

\
![Creating XSD of a XML using Visual studio](http://www.mindstick.com/MindStickArticle/928e8043-b6b9-4f48-9bb0-34e65164134a/Images/image006.png)

\
5) I changed the data type of PRODCUTID tag to integer. And saved it.

\
![Creating XSD of a XML using Visual studio](http://www.mindstick.com/MindStickArticle/928e8043-b6b9-4f48-9bb0-34e65164134a/Images/image008.png)\

6) Now I changed value of [PRODUCT](https://yourviews.mindstick.com/view/83909/why-mindstick-platform-is-so-important-for-our-product-promotions) ID tag to some [string value](https://www.mindstick.com/forum/23050/how-to-convert-string-value-to-hexa-value-in-vb-dot-net). It starts

validating to created xsd file.

\
[Now as](https://answers.mindstick.com/qa/36803/how-hot-is-salesforce-now-as-a-carrier-choice) we changed the value of product id, it starts [showing error](https://www.mindstick.com/forum/23168/windows-phone-8-emulator-showing-error-when-connecting-to-wcf-service) as per below

screen.

![Creating XSD of a XML using Visual studio](http://www.mindstick.com/MindStickArticle/928e8043-b6b9-4f48-9bb0-34e65164134a/Images/image010.png)

Conclusion

Creating XSD of XML file is very simple if we follow above steps.

---

Original Source: https://www.mindstick.com/articles/1400/creating-xsd-of-a-xml-using-visual-studio

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
