Lesson 1: Creating an XML model

In this lesson, you will create an XML model and add elements and attributes to the model.

  1. If the tutorial database is already running, go to step 2.

    If the tutorial database is not running, in the WorkSpace Navigator, expand the folder MySybStore_Tutorials/Setup/Database. Right-click startMySybStore.bat and select Open With|System Editor to start the tutorial database.

    You should see the Adaptive Server Anywhere icon in your Windows system tray.

  2. If a connection to the SybStore tutorial database is already established, skip to step 3. When there is a successful connection, you see a database icon below the SybStore connection profile in the Enterprise Explorer.

    If you are not connected, in the Enterprise Explorer, right-click the MySybStore connection profile, which you created in the tutorial setup, and select Connect to connect WorkSpace to the tutorial database.

  3. Open the Enterprise Modeling perspective. Select Window|Open Perspective|Enterprise Modeling from the WorkSpace main menu bar.

  4. Select File|New|Model from the WorkSpace main menu. The New model wizard opens.

  5. Select Add To An Existing Project, select MySybStore_Tutorials, and click Next.

  6. When the Destination Folder dialog box displays, expand the folder MySybStore_Tutorials/Models, and click Finish.

  7. When the New dialog box opens to the General tab, make these selections:

  8. Click OK. The XML Model editor appears, with an empty diagram and a toolbar.

  9. Select the Element tool from the editor toolbar.

  10. Click anywhere in the editor pane. An element symbol appears in the editor.

  11. Hover the Element tool over on the right side of the element symbol you just added.

    When the pointer changes to an arrow, click to add a child element to Element_1.

  12. Continue clicking to add a total of four child elements to Element_1.

  13. Right-click in the editor to return to the pointer.

  14. Double-click the parent Element_1 symbol in the editor.

  15. When the Element Properties dialog box displays, select the General tab, and enter SalesDetail for the element Name.

  16. Click OK. The name you entered appears on the element symbol in the editor.

  17. Repeat the following steps a – d for each child element.

    1. Double-click the child element symbol in the editor.

    2. In the Element Properties dialog box, select the General tab, and enter the Name and select the Type (datatype) for the child element

      Use the values in the following table for the child element properties.

      Child element

      Name

      Type

      Minimum

      Maximum

      Element_1

      ItemNum

      Xs:string

      1

      1

      Element_2

      Qty

      Xs:positiveInteger

      1

      1

      Element_3

      Price

      Xs:float

      1

      1

      Element_4

      SalesID

      Xs:positiveInteger

      1

      1

    3. Select the Detail tab, and enter the Minimum and Maximum values.

    4. Click OK.

      When you finish, each child element displays its name and datatype, between brackets, below the name.

      The finished diagram should look like this:

  18. In the Model Explorer, double-click the icon beside the default model name XMLModel_1*.

  19. In the Model Properties dialog box, enter MySybStoreXMLModel in the Name field and click OK.

  20. Select File|Save from the WorkSpace main menu to save the XML model.

    If you are continuing, keep the model open for the next tutorial.