![]() |
Previous Top Next |
Adding elements to a schema
|
1. | Click the component icon ![]() |
The text below the company element is annotation text. Double click the text if you want to edit it. (shortened to "Root element" here.)
|
2. | Right click the Company element to open the context menu, and select Add Child | Sequence.
|
![]() |
This inserts the Sequence compositor, and defines that the following elements must appear in the same sequence (in the XML document).
|
![]() |
3. | Right click the Sequence compositor and select Add Child | Element.
|
4. | Enter "Address" as the name of the element, and confirm with the Enter key.
|
![]() |
5. | Right click the Sequence compositor again, select Add Child | Element, and enter "Person" as the name of the element.
|
![]() |
We have now defined a schema which allows for one address and one person per company. As this is too restrictive, we want to make sure that we can include as many persons per company as necessary.
|
|
6. Right click the Person element, and select Unbounded from the context menu.
|
The Person element changes at this point, showing the range in which it can occur, in this case 1 to infinity.
|
![]() |
Please note:
|
You can also edit the minOcc and maxOcc fields in the Details entry helper directly.
|
|
We will now add the sub-elements which define the address structure.
|
|
1. | Right click the Address element to open the context menu, and select Add Child | Sequence.
|
2. | Right click the Sequence compositor, and select Add Child | Element. Enter "Name" as the element name.
|
|
![]() |
1. | Click the Name element, if not currently selected.
|
2. | Click on the type combo box of the middle entry helper, and select the entry xs:string from the drop down list.
|
![]() |
This entry helper is called "Details" in the Schema view, and provides information on the currently selected element. All data can be edited directly in the Details window!
|
|
An icon appears in the top left of the element ![]() |
Both "minOcc" and "maxOcc" fields contain 1, showing that there is only one occurrence of this element (this is the default setting when creating a new element).
|
![]() |
|