In this lesson, you will create an XML model and add elements and attributes to the model.
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.
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.
Open the Enterprise Modeling perspective. Select Window|Open Perspective|Enterprise Modeling from the WorkSpace main menu bar.
Select File|New|Model from the WorkSpace main menu. The New model wizard opens.
Select Add To An Existing Project, select MySybStore_Tutorials, and click Next.
When the Destination Folder dialog box displays, expand the folder MySybStore_Tutorials/Models, and click Finish.
When the New dialog box opens to the General tab, make these selections:
Model Type – XML Model
Select New Model
Model Name – accept the default
XML Language – XML Schema Definition 1.0
Select Share the XML Language Definition
Click OK. The XML Model editor appears, with an empty diagram and a toolbar.
Select the Element tool from the editor toolbar.
Click anywhere in the editor pane. An element symbol appears in the editor.
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.
Continue clicking to add a total of four child elements to Element_1.
Right-click in the editor to return to the pointer.
Double-click the parent Element_1 symbol in the editor.
When the Element Properties dialog
box displays, select the General tab, and enter SalesDetail
for
the element Name.
Click OK. The name you entered appears on the element symbol in the editor.
Repeat the following steps a – d for each child element.
Double-click the child element symbol in the editor.
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 |
|
|
|
|
Element_2 |
|
|
|
|
Element_3 |
|
|
|
|
Element_4 |
|
|
|
|
Select the Detail tab, and enter the Minimum and Maximum values.
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:
In the Model Explorer, double-click the icon beside the default model name XMLModel_1*.
In the Model Properties dialog
box, enter MySybStoreXMLModel
in
the Name field and click OK.
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.