login | register    

Liquid XML Studio - XML Sample Generator

Overview

The XML Sample generator is a tool which creates an XML document from an XML Schema (XSD). The user selects the element that will become the root node in the XML document, and the generator does the rest, creating all the child elements and attributes, populating them with valid placeholder values. Options allow you to control the size of the generated document by forcing or restricting the creation of optional elements to a given depth in the XML document. This allows you to create minimal sample instances or comprehensive fully populated documents. Where a choice needs to be made regarding the type of element that should be created (i.e. <choice> or were types extend a <complexType>) the selection is made randomly providing good test data.

Usage

Prototyping

While designing XML Schemas it is often useful to be able to see what the resulting XML documents will look like. The XSD

Schema diagrams make it clear of the structure, but it is sometimes easier to see an example of an actual document in order to get a clear picture. The XML Sample generator does exactly this, it takes an XSD and generates random sample XML documents based on your XSD. This allows you to quickly see any un expect artifacts in the XML document.

Development

When tasked with reading an XML document into an application, it is useful to have a good set of valid test cases to work from. In the early stages of a development project such examples can be thin on the ground, so being able to generate them can save hours of manual typing. Furthermore when writing XML from an application, it is useful to have a clear idea of what the XML should look like, such samples make it much easier to see where the applications output differ from the test cases. For reading and writing XML from an application see XML Data Binding.

Testing

Testing an application is all about having good test cases, and good test cases need good test data. Being able to generate sample XML documents can save huge amounts of time when creating your test data, as it provides the skeletal message, making easy for meaningful test values to be inserted into the document.

1<?xml version="1.0" encoding="utf-8"?> 2<!-- Created with Liquid XML Studio --> 3<bookstore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:noNamespaceSchemaLocation="BookStore.xsd"> 5 <book price="730.54" ISBN="string" 6 publicationdate="2016-02-27"> 7 <title>string</title> 8 <author> 9 <first-name>string</first-name> 10 <last-name>string</last-name> 11 </author> 12 <genre>string</genre> 13 </book> 14 <book price="6738.774" ISBN="string"> 15 <title>string</title> 16 <author> 17 <first-name>string</first-name> 18 <last-name>string</last-name> 19 </author> 20 </book> 21</bookstore>

XML file generated from the bookstore sample Xml Schema(see source code)

Click to enlarge

 

Applies to Liquid XML Studio 2009:
Community Edition Available in this Edition
Designer Edition Available in this Edition
Developer Edition Available in this Edition