Use xmlspy or Sun’s Instance Generator to create instances of DTDs or other schemas.
Perhaps you need to generate XML instances of a given schema to create a test suite or you want a collection of instance files for some other reason. xmlspy (http://www.xmlspy.com) can create a single instance of a DTD or XML Schema document, but the Sun Instance Generator, a Java program, can create many XML instances based on a DTD, RELAX NG, Relax, or XML Schema. If you want a quick look at a single instance, xmlspy may be adequate for you. However, if you need a set of files, including some with intentional errors in them, Sun’s tool is probably the way to go. This hack shows you how to use both tools.
These instructions assume that you have already downloaded and installed xmlspy 2004 Professional or Enterprise Edition (this won’t work with the Home Edition). Follow these steps to create an instance of the DTD time.dtd:
Choose File → Open and the Open dialog box appears. Navigate to the working directory of files from the book file archive and select the file time.dtd. Then click the Open button.
Choose DTD/Schema → Generate sample XML file. The Generate sample XML file dialog box appears. All the radio buttons should be selected by default, and the repeatable elements text box should contain the number 1. This means that xmlspy will generate a document that includes all non-mandatory elements and attributes, ...