The XML Generator is a powerful tool for automatically generating XML instance documents which conform to any XML Schema data model. (illustrated below - click to enlarge). The generation of the sample XML files can be customized according to your preferences, and always results in valid, well-formed XML. This tutorial covers in detail, how to use the XML generator to create a sample XML file from any XML Schema in Stylus Studio.
Generating Sample XML Documents From XML Schema
Generating an sample XML file in Stylus Studio is a simple two-step process. First, load your XML Schema in the Stylus Studio XML Schema Editor. The Stylus Studio XML Schema Editor provides a visual interface for designing XML data models; just select any XML Schema element (for example, the document 'root' node), the selected node will be highlighted in blue. Right-click, and then select "View Sample XML" from the short-cut menu, as illustrated here:
Previewing the Generated Sample XML Document
Stylus Studio will automatically generate a sample XML document corresponding to the XML element that you have selected, allowing you to create complete XML documents or XML document fragments according to your selection. Stylus Studio allows you to browse the generated sample XML document if you are happy with the result, click on the "open as a new document" button and Stylus Studio will launch a new XML document with the contents of the generated XML file.
Validating the Generated XML Document
We said earlier that Stylus Studio's XML document generator always generates well-formed and valid XML files - but don't take our word for it, see for yourself. The generated XML file includes the XML schema association, alowing you to validate the generated XML file against the original XML Schema definition using any of the leading XML schema validators, for example, MSXML, Microsoft System.XML, Apache Xerces, XSV 2.8, or any other validating XML parser. To validate, from within the XML editor, click on the "Validate Document" button, as illustrated below, then choose the processor you wish to use to perform the validation. The Output Window displays the result of the validation - as expected, "The XML Document Untitled3.xml is valid". As an excercise, try using the Stylus Studio XML document generator on more complex XML Schema data models involving facets, restrictions, ennumerations, type derivations, or whatever - Stylus Studio will always genererate valid XML.
Configuring the way Stylus Studio Generates Sample XML Documents
Stylus Studio provides complete flexibility when it comes to customizing the way in which sample XML documents are generated, for example, you can specify how to handle optional elements, repeating elements, choices and substitution groups, etc. You can access the configuration menu from the Tools -> Options -> Module Settings -> XML Schema Editor -> XML Schema to XML pannel, as illustrated here:
Stylus Studio's XML Instance Document Generator is a powerful utility for accelerating XML development alowing you to leverage existing XML schemas to automate the creation of instance documents in a highly configurable way.
PURCHASE STYLUS STUDIO ONLINE TODAY!!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Try Stylus XML Generator
Generate XML instance documents from Schema or DTD with Stylus Studio — Free Trial!
What's New for Stylus Studio® X16?
New XQuery & Web Services Tools, Support for MySQL, PostgreSQL, HL7 EDI, Microsoft .NET Code Generation and much more!