Generate XSD

The Generate XML Schema feature forward engineers a UML Class model to a W3C XML Schema (XSD) file. An XML schema corresponds to a UML package in Enterprise Architect, therefore XML schema generation is a package-level operation. To generate an XML schema from a package, follow the steps below:

  1. In the Project Browser, right-click on the package to be converted to XSD. The context menu displays.
  2. Select the Code Engineering | Generate XML Schema menu option. The Generate XML Schema dialog displays, showing the name of the selected package in the Source Package field.
     
    GenerateXMLDialog
     
  3. In the Encoding field, set the required XML encoding.
  4. In the XSD Style panel, the Generate global element for all global ComplexTypes checkbox is selected by default to generate schema in the Garden of Eden style.
  5. In the Referenced Package Options panel, select the:
  • Generate XSD for Referenced packages checkbox to generate schema for packages that are referenced by any of the packages selected in the list box
  • Prompt when missing Filename checkbox to enable Enterprise Architect to prompt for a filename for a referenced package during schema generation, if the filename is missing.
  1. In the Child Package Options panel, select the:
  • Generate XSD for Child Packages checkbox to generate schema for child packages of the selected package
  • Include all packages radio button to list all child packages under the parent package in the list box
  • Include <XSDschema> packages radio button to list only those packages that have the stereotype «XSDschema».

The list box displays, for each package, the package name and the file path where the schema file is to be generated.

  1. If it is necessary to change the file path for a package, double-click on the entry in the list box and, on the Select XML File dialog, type or select the appropriate file path.
  2. Ensure that the checkbox is selected for each package required for generation.
  3. Click on the Generate button to generate the schema for each of the selected packages.
  4. The progress of the schema generator is shown in the Progress box.
  5. When schema generation is complete, click on an entry in the list box and click on the View Schema button to review the generated schema.

Tip:

The Generate XML Schema dialog can also be accessed from the active diagram by selecting the Project | XML Schema | Generate XML Schema menu option.