xml spy
Previous  Top  Next
Completing the basic schema

At this point we want to add those sub elements to the Person element, which make up the personal data. All these elements will be simple types (with simple content models).

Person sub-elements: First, Last, Title, PhoneExt, and Email.

Requirements:
Title element:   should be optional
PhoneExt:   should be an integer and limited to 2 digits

1.Right click the Person element to open the context menu, and select Add Child | Sequence. This inserts the Sequence compositor.  
2.Right click the Sequence compositor, and select Add Child | Element.  
3.Enter "First" as the name of the element, and hit the "Tab" key. This automatically places you in the type field.  

   tut_13a

4.Select (or enter) the xs:string entry from the drop down list.  
5.Use the drag and drop method to create four more elements, and name them: Last, Title, PhoneExt, and Email respectively.  

tut_14a  

Please note:  
You can select multiple elements by holding down the CTRL key, and clicking each one.  

To make an element optional:

1.Right click the Title element, and select Optional from the context menu.  
The solid element frame changes to a dashed one; this is the visual display that an element is optional.  

tut_14b  

The "Details" fields have also been updated minOcc=0 and maxOcc=1.  

To limit the content of an element (Facets):
1.Double click in the type field of the PhoneExt element, and select (or enter) the xs:integer entry from the drop down list.  

tut_14c  

The items in the Facets tab (in the lowest entry helper) change at this point.  
2.Double click in the "maxIncl" field of the Facets tab (in the lowest entry helper) and enter 99, confirm with Enter.  

tut_15a  

This defines that all phone extensions up to, and including 99, are valid.  
3.Select the menu option File | Save to save the changes to the schema.  

Please note:
·Selecting a predefined simple type "text" (i.e. xs:string, xs:date etc.) for an element, automatically changes the content model to: content = simple, in the Details entry helper.  

·Adding a compositor to an element (selection, choice or all), automatically changes the content model to: content = complex, in the Details entry helper.  

·This schema is available as 'AddressFirst' in the ..\Tutorial folder.  
 

Previous  Top  Next

© 2002 Altova