XML document samples > Generating samples from DTDs and XSDs

Generating samples from DTDs and XSDs
If you have the appropriate DTD/XSD, you can use the XMLIN tool to generate a sample based on the DTD/XSD. The generated sample is a temporary file that is loaded into the XMLIN tool.
Methods
You can use three methods to generate an XML document sample based on a DTD/XSD:
Generate on load. With this method, you cannot configure anything. The XML document will be created when the DTD/XSD is loaded. See Generate on load.
Manually – typical. With this method, you can specify the number of instances and recursion level for the elements. What you specify here applies to all elements. You can also specify which element is the root element, and where to store the temp file. See Typical configuration.
Manually – custom. With this method, you can customize the number of instances and recursion level per element. You can also specify which element is the root element, and where to store the temp file. See Custom configuration.
Recursion level and Number of instances
The DTD/XSD contains information about the number of allowed instances of an element type within another element type. This information does not explicitly describe “five type A elements, ten type B elements” etc. Instead it describes “one type A element, one or more type B elements, zero or more type C elements” etc. If no more information was provided, the XMLIN tool would not know when to stop generating the XML sample. To know when to stop, the XMLIN tool needs the following input:
Recursion level – specifies how many instances of itself an element type may contain. See Recursion level.
Number of instances – specifies how many instances of other element types an element type may contain. See Number of instances.
Example 2
This DTD example illustrates how many instances of itself the <article> element can contain when Recursion level is set to 1 and 2.Click to enlarge
 
Example 3
This DTD example illustrates how many instances of the <description> element the <article> element can contain when Number of instances is set to 1 and 3.Click to enlarge
 
OpenText StreamServe 5.6 Updated: 2013-03-01