Liquid XML Studio
Create Sample XML Document
Send Feedback
XSD Editor > Tools > Create Sample XML Document

Glossary Item Box

It is possible to create a sample XML document from an XML Schema. This can be done by using the "Tools->Create Sample XML Document" Menu ().

The sample XML Document is created by stepping though the possible options in the schema and creating the appropriate elements and attributes as it goes. The path that the sample builder takes through the schema is random, so each time you generate a sample file it make contain different items.

The builder attempts to create values for each element/attribute that reflect its type and restrictions, however this is not always possible (especially for regular expression restrictions).

 Step 1

The first step in creating a sample is to deicide what the root element will be. The wizard presents a list of all the possible options.

 

Step 2 

Step 3

There are a number of generation options that effect the way the your sample file is constructed.

Include a 'schemaLocation' attribute

If you select this option, then the schemaLocation or noNamespaceSchemaLocation attribute is added to the root element in the sample. This allows parsers to determine the XSD file that can be used to validate the XML file. This also allows you to use intellisense.

You can also change the way the schema is referenced in this attribute - i.e. you could make the path relative, or reference a schema on a remote web server etc.

Force the creation of optional entities to a depth of

Whenever an optional entity appears in the schema (an element with minoccurs 0, an attribute with use=optional), then it is 50/50 whether the entity will appear in the resulting XML. This option forces these entities to appear in the schema until the element nesting depth hits this value (then is 50/50 as to whether they appear).

In this sample a has a nesting depth of 1, b of 2, c of 3.

<a>
    <b>
        <c/>
    </b>
</a>

This option can force more child elements into your sample XML, but set it to high and your sample may become very large!

Stop Creating optional items after a depth of

Whenever an optional entity appears in the schema (an element with minoccurs 0, an attribute with use=optional), then it is 50/50 whether the entity will appear in the resulting XML. This option prevents these entities from appearing in the schema after the element nesting depth hits this value.

This can prevent your sample XML file from becoming to large.

Step 4

You can also control the default namespace and the namespace aliases that will be used in the XML document.