The XML Schema (XSD) to XML instance generator tool is useful for generating sample XML messages based on an XML Schema (XSD) document. It is accessible under XSD->XML tab under the Tools tab.
The first step is to add a schema file by uploading it to the server. This is done by clicking on ‘’ and uploading either a single schema file (.xsd) or a zip file containing the main schema file and its references.
The uploaded schema file is displayed in a table on the left and clicking on the schema file name, displays the contents in the editor (Schema tab) on the right. The ‘’ and ‘’ buttons under the Schema tab can be used to make changes to the schema being edited or revert any unsaved changes.
When the schema is displayed, the Root Element drop-down box displays all the root elements declared in the schema file, which can be used as the starting root element in the generated XML file. The screenshot below shows the process of selecting a root element in a schema file:
The XML instance generation can be configured through certain options which are available by clicking on the button. The options dialog is as shown below:
Controls whether attributes which are specified as optional in the schema will be generated
Controls whether attributes which are specified as optional in the schema will be generated
Controls whether XML comments (of the form <!-- …
-->) will be generated for the schema
particles
Controls the number of duplicate elements to generate when the maxOccurs attribute value is ‘unbounded’ for the element. Default value = 3
Controls the number of recursive calls to make when processing an element which refers to itself, or to another element which in turn refers to the element referring it. Default value = 1
Controls which element to select when processing the
<xs:choice/> element. The available options
are: First and Random. First will result in the first element
under choice getting selected and Random results in a random
pick of the element to process
Controls whether the generated XML will be in compact form or pretty-printed
Clicking on ‘’ will result in the currently selected options being applied to the generation process. A new tab displaying the generated XML is shown next to the ‘Schema’ tab for every generation.