Generating an Instance Document for an XML Schema

You can generate a sample XML document instance that uses elements and attributes defined in an XML schema. For example, you may need a document instance to test services that operate on documents using the schema. You can generate document instances using the XML Editor or the XSD Viewer.

To generate a document instance:

  1. Open the schema in the XML Editor.

    If the schema is already open in the XML Editor, save any changes.

  2. Choose from the following:

    • In the XML Editor, selectXML|Generate Instance Document.

    • In the XSD Viewer, select Schema|Generate Instance Document.

  3. Configure the following options:

    Instance Document Generation dialog

    FieldDescription

    Root Element

    Specify which element should be the root element.

    Create Optional Elements

    Specify whether to create child elements in parent element instances where they are optional .

    Create Optional Attributes

    Specify whether to add values for optional attributes.

    Repeat Count

    Specify how many instances of an element to add in contexts where the schema allows repeating elements.

  4. Click OK to generate the document instance.

    The generated document instance appears in a new XML Editor window.

    Note

    Generated documents are read-only and are not created in the file system. To create a persistent copy, choose File | Save As to save them to disk. You can edit the text after saving to disk.

XML Editor

XSD Viewer

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com