Generate Sample XML Data From XSD Using Visual Studio

Category: XmlTags: ,

If you have an XSD file, it is difficult to visualize how the XML file structure looks like. As a developer, you are mostly dealing with XML. As XML file quickly visualizes the data structure, you are looking for a way to get XML file with dummy data from a given XSD file.

Visual Studio provides a quick way to generate sample XML file with dummy data from XSD file.

Here is a step by step guidance.

Step By Step Guide to Generate Sample XML From XSD File

Open Visual Studio.

Drag XSD file on Visual Studio or go to Visual Studio > File > Open > File and select the XSD file to open.

Click on “XML Schema Explorer” as shown in the image below.

Visual Studio open XSD file

Within “XML Schema Explorer” scroll all the way down to find the root/data node.

Right click on root/data node and it will show “Generate Sample XML”.

If it does not show option “Generate Sample XML”, it means you are not on the data element node but you are on any of the data definition node.

Visual Studio XSD file Generate Sample XML Data

Namespace Error

If you face difficulty generating the sample XML data and encounter error regarding namespace, resolve xsd namespace error by following these steps.



Your email address will not be published. Required fields are marked *

  1. David Burg says:

    For all optional fields the default behavior for the Visual Studio generator is to write a xmlns:xsi=”” xsi:nil=”true” attribue. Is there any configuration option to get the generator to instead write a sample non-null payload?

  2. Robert says:

    In MS VS 2008 there is no “XML Schema Explorer” …:(