Setup instructions for the UML-to-XSD transformation extension

Before you run the sample UML-to-XSD transformation extension, you must import the plug-in into your workspace, create a runtime workbench, and create a transformation configuration.

Import the sample

Before you begin
You must be in the Java perspective.
  1. On the sample overview page, click Import the sample.
  2. In the Import sample wizard, specify the destination project name for the sample files.
  3. Click Finish.
  4. If you are prompted to switch to the Resource perspective, click No. The wizard creates the new project in your workspace. The Project Explorer view displays the new plug-in project.
  5. If the Build Automatically preference is enabled, you must disable it before you build the project: Click Project > Build Automatically, and verify that a check mark is not displayed beside this option.
  6. Click Project > Build Project.
  7. To verify that the project built correctly, check the Problems view for errors.
Results

The imported plug-in contains a Java class that contains the transformation extension rule. Examine the plugin.xml file to understand how to extend the UML-to-XSD transformation. In the Java class named XSDSchemaDefaultValueRule.java, examine the code in the createTarget method to understand how the transformation extension generates a schema that shows the default values of the attributeFormDefault and elementFormDefault attributes.

Create a runtime workbench

  1. Click Run > Run Configurations.
  2. In the Run Configurations window, click Eclipse Application, and click the New launch configuration icon.
  3. Accept the default values and click Run.
  4. Click Run.

Create a UML-to-XSD transformation configuration

Before you begin
You must be in the Modeling perspective.
  1. In the runtime workbench that you created in the previous step, create a project that contains a UML model: Click File > New > Other > Modeling > Model Project.
  2. Click Next.
  3. On the Create Model Project page, in the Project name field, specify a name for the new project.
  4. Click Next.
  5. Under Categories, click General; under Templates, click Blank Package.
  6. Click Finish.
  7. Create a transformation configuration: Click File > New > Other > Transformations > Transformation Configuration.
  8. Click Next.
  9. In the New Transformation Configuration wizard, on the Specify a Configuration Name and Transformation page, complete the following steps:
    1. Specify the name and destination of the transformation configuration.
    2. From the Transformation list, select Service Oriented Architecture Transformation > UML to XSD.
  10. Click Next.
  11. On the Source and Target page, under Selected source, expand the new project, expand the Models folder, and click the model.
  12. Under Selected target, click the name of the new project.
  13. Click Finish. The transformation configuration editor opens.
  14. In the transformation configuration editor, on the Extensions page, verify that the com.ibm.xtools.transform.uml2.xsd.XSDSchemaDefaultValue check box is selected.
  15. Click File > Save.

Run the UML-to-XSD transformation extension sample application

  1. In the transformation configuration editor, on the Main page, click Run. The transformation generates an XSD schema that has the same name as the model and that has .xsd as a file name extension.
  2. Examine the generated output: Double-click the generated XSD schema. The attributeFormDefault and elementFormDefault attributes are displayed in the generated schema even though they contain default values.

Feedback