Edit online

Generating Sample XML Files

Oxygen XML offers support to generate sample XML files both from XML schema 1.0 and XML schema 1.1, depending on the XML schema version set in XML Schema preferences page.

To generate sample XML files from an XML Schema, use the Generate Sample XML Files action from the ToolsXML Tools menu. This action is also available in the contextual menu of the schema Design mode. The action opens the Generate Sample XML Files dialog box that allows you to configure a variety of options for generating the files.

The Generate Sample XML Files dialog box contains three tabs with various configurable options. Default values for these options can be set in the Sample XML Files Generator preferences page. You can also run the tool from the command line using exported options.

Schema Tab

The first set of options for the Generate Sample XML Files tool are found in the Schema tab.

Figure 1. Generate Sample XML Files Dialog Box (Schema Tab)
This tab includes the following options:
URL
Specifies the URL of the Schema location. You can specify the path by using the text field, the history drop-down menu, or the browsing actions in the Browse drop-down list.
Namespace
Displays the namespace of the selected schema.
Root Element
After the schema is selected, this drop-down menu is populated with all root candidates gathered from the schema. Choose the root of the output XML documents.
Output folder
Path to the folder where the generated XML instances will be saved.
Filename prefix and Extension
You can specify the prefix and extension for the file name that will be generated. Generated file names have the following format: prefixN.extension, where N represents an incremental number from 0 up to the specified Number of instances.
Number of instances
The number of XML files to be generated.
Open first instance in editor
When selected, the first generated XML file is opened in the editor.
Namespaces section
You can specify the Default Namespace, as well as the prefixes for the namespaces.
Export settings
Use this button to save the current settings for future use.
Import settings
Use this button to load previously exported settings.

You can click OK at any point to generate the sample XML files.

Options Tab

The Options tab allows you to set specific options for namespaces and elements.

Figure 2. Generate Sample XML Files Dialog Box (Options Tab)
This tab includes the following options:
Namespace / Element table
Allows you to set a namespace for each element name that appears in an XML document instance. The following prefix-to-namespace associations are available:
  • All elements from all namespaces (<ANY> - <ANY>). This is the default setting.
  • All elements from a specific namespace.
  • A specific element from a specific namespace.
Settings subtab
Namespace
Displays the namespace specified in the table at the top of the dialog box.
Element
Displays the element specified in the table at the top of the dialog box.
Element values subtab
Allows you to add values that are used to generate the content of elements. If there are multiple values, then the values are used in a random order.
Attribute values subtab
Allows you to add values that are used to generate the content of attributes. If there are multiple values, then the values are used in a random order.
Export settings
Use this button to save the current settings for future use.
Import settings
Use this button to load previously exported settings.

You can click OK at any point to generate the sample XML files.

Advanced Tab

The Advanced tab allows you to set some options regarding output values and performance.

Figure 3. Generate Sample XML Files Dialog Box (Advanced Tab)
This tab includes the following options:
Export settings
Use this button to save the current settings for future use.
Import settings
Use this button to load previously exported settings.
Note: