How to generate sample XML documents from their DTD or XSD?

lindelof picture lindelof · Aug 20, 2008 · Viewed 244.7k times · Source

We are developing an application that involves a substantial amount of XML transformations. We do not have any proper input test data per se, only DTD or XSD files. We'd like to generate our test data ourselves from these files. Is there an easy/free way to do that?

Edit

There are apparently no free tools for this, and I agree that OxygenXML is one of the best tools for this.

Answer

Sam Warwick picture Sam Warwick · Sep 3, 2008

In Visual Studio 2008 SP1 and later the XML Schema Explorer can create an XML document with some basic sample data:

  1. Open your XSD document
  2. Switch to XML Schema Explorer
  3. Right click the root node and choose "Generate Sample Xml"

Screenshot of the XML Schema Explorer