Sample XML Files Generator Preferences
The Generate Sample XML Files tool (available on the menu) allows you to generate XML instance documents based on a W3C XML Schema. There are various options that can be configured within the tool and these options are also available in the Sample XML Files Generator preferences page. This allows you to set default values for these options. To configure the options for generating the XML files, open the Preferences dialog box and go to .
The following options are available:
- Generate optional elements
- When checked, all elements are generated, including the optional ones (having the
minOccursattribute set to 0 in the schema). - Generate optional attributes
- When checked, all attributes are generated, including the optional ones (having the
useattribute set tooptionalin the schema). - Values of elements and attributes
- Controls the content of generated attribute and element values. The following
choices are available:
- None - No content is inserted.
- Default - Inserts a default value depending of data type descriptor of the particular element or attribute. The default value can be either the data type name or an incremental name of the attribute or element (according to the global option from the XML Instances Generator preferences page). Note that type restrictions are ignored when this option is enabled. For example, if an element is of a type that restricts an xs:string with the xs:maxLength facet to allow strings with a maximum length of 3, the XML instance generator tool may generate string element values longer than 3 characters.
- Random - Inserts a random value depending of data type
descriptor of the particular element or attribute.
Important
If all of the following are true, the XML Instances Generator outputs invalid values:- At least one of the restrictions is a
regexp. - The value generated after applying the regexp does not match the restrictions imposed by one of the facets.
- At least one of the restrictions is a
- Preferred number of repetitions
- Allows you to set the preferred number of repeating elements related to
minOccursandmaxOccursfacets defined in the XML Schema.- If the value set here is between
minOccursandmaxOccurs, then that value is used. - If the value set here is less than
minOccurs, then theminOccursvalue is used. - If the value set here is greater than
maxOccurs, thenmaxOccursis used.
- If the value set here is between
- Maximum recursion level
- If a recursion is found, this option controls the maximum allowed depth of the same element.
- Type alternative strategy
- Used for the
xs:alternativeelement from XML Schema 1.1. The possible strategies are:- First - The first valid alternative type is always used.
- Random - A random alternative type is used.
- Choice strategy
- Used for
xs:choiceorsubstitutionGroupelements. The possible strategies are:- First - The first branch of
xs:choiceor the head element ofsubstitutionGroupis always used. - Random - A random branch of
xs:choiceor a substitute element or the head element of asubstitutionGroupis used.
- First - The first branch of
- Generate the other options as comments
- If enabled, generates the other possible choices or substitutions (for
xs:choiceandsubstitutionGroup). These alternatives are generated inside comments groups so you can uncomment and use them later. Use this option with care (for example, on a restricted namespace and element) as it may generate large result files. - Use incremental attribute / element names as default
- If checked, the value of an element or attribute starts with the name of that
element or attribute. For example, for an
aelement the generated values are:a1,a2,a3, and so on. If not checked, the value is the name of the type of that element / attribute (for example:string,decimal, etc.) - Maximum length
- The maximum length of string values generated for elements and attributes.
- Discard optional elements after nested level
- The optional elements that exceed the specified nested level are discarded. This option is useful for limiting deeply nested element definitions that can quickly result in very large XML documents.