Creating XML Schemas (for Version 2 Rulesets)

This Schema (xml.objSchema) handles complex XML data structures using an XML Schema Definition (XSD). The Clarify XML Schema wizard helps you build binding files that can be used repeatedly to create and define XML Schemas.

An XSD must exist for this process. Always define a target Namespace in your XSD, as this prevents conflicts within your Clarify Project, mainly in the classes that are generated as part of Schema creation.

Steps

  1. Create an XML Schema. (select from File| New in the main menu bar or use right-click options - New|Other|Schemas). This launches the XML Schema wizard.
  2. Select which version (1 or 2) of the Schema to generate:

    • Version 2 XML Schemas build bindings from the imported XSD; binding a schema means generating a set of Java classes that represents the schema. This is the default and recommended version.

    • Version 1 XML Schemas are built without bindings. Only select this option when building integrations that run in the older, v1 transformation engine. See Creating XML Schemas with an XSD or DTD (for Version 1 Rulesets only) to continue.
      Note: The remaining steps do not apply (nor appear in the wizard) if creating a Version 1 XML Schema.

  3. Choose among three options: import an XSD, use an existing bindings file to create your XML Schema, or update an existing bindings file. Each option requires its own set of steps, as described below.

    • IMPORT XSD: Select this option when importing the XSD into Clarify for the first time, or when updating an existing bindings file in your Project - basically overwriting the older bindings file (by basically re-importing the XSD). The XML Schema is read-only.

      1. Select the XSD from a filesystem or Workspace location.
      2. Select the Package.

      3. The Override Package checkbox indicates how the Schema reacts if there are undefined target Namespaces in the XSD. When multiple XSDs contain the same XML elements without the targetNamespace defined, classloading conflicts occur, which affect Ruleset mapping and can cause runtime errors. The checkbox helps Clarify determine the package to which the classes will be generated.

        • When selected, the Override Package defined here will be used for those XSD Elements that do not have a targetNamespace defined.
        • When not selected, then all XSD Elements use the Override Package defined in the field above.
          Note: in rare cases in which a bindings file has been generated and contains the same packages or target namespaces, the checkbox should not be selected; this will force an override of the destination package for the generated bindings.
      4. Validate the XSD (using the Validate button). Potential classpath conflicts will be checked as part of validation (see next step), and detailed error messages will be provided.
      5. Select Root Elements for Schema Generation. All Root Elements in the XSD are shown in the Available Classes pane. Make sure to select and move the Element(s) from Available to Selected.
      6. Press Finish.

      Result: Clarify generates an XML Schema, a bindings file, and other resources used to build and read XML files. The XSD is also copied into the Project under an xsd folder.

    • USE EXISTING BINDINGS: This option allows you to create another XML Schema based on an existing bindings file from an XSD that was previously imported into Clarify. For example, the first time the XSD was imported only some of the elements were chosen for an XML Schema; now other elements from the XSD will be used in a different XML Schema.

      1. Select the bindings file from Workspace.
      2. Select Root Elements for Schema Generation. All Root Elements in the XSD are shown in the Available Classes pane. Make sure to select and move the Element(s) from Available to Selected.
      3. Press Finish.

      Result: Clarify generates an XML Schema based on the selected bindings file.

    • UPDATE EXISTING BINDINGS: This option allows you to update or override an existing bindings file (which could then be used the next time you create a schema using an existing bindings file).

      1. Select the bindings file from Workspace.
      2. Select the XSD from a filesystem or Workspace location.
      3. The Override Package checkbox indicates how the Schema reacts if there are undefined target Namespaces in the XSD. When multiple XSDs contain the same XML elements without the targetNamespace defined, classloading conflicts occur, which affect Ruleset mapping and can cause runtime errors. The checkbox helps Clarify determine the package to which the classes will be generated.
        Note:

        The previously-set override package value should already be displayed. As long as this value remains unchanged, Clarify generates the bindings with the same value.

      4. Validate the XSD (using the Validate button). Potential classpath conflicts will be checked as part of validation, and detailed error messages will be provided if necessary.
      5. Press Finish.

      Result: Clarify updates the selected bindings file, but does not create a Schema.

This task is complete. To use the XML Schema, select it when Creating Rulesets.