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.
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.
If you face difficulty generating the sample XML data and encounter error regarding namespace, resolve xsd namespace error by following these steps.
Nothing to say except thank you so much 🙂
For all optional fields the default behavior for the Visual Studio generator is to write a xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:nil=”true” attribue. Is there any configuration option to get the generator to instead write a sample non-null payload?
In MS VS 2008 there is no “XML Schema Explorer” …:(