![]() |
| Previous Top Next |
Including Types Using Only XMLSpy |
In this section you will use only XMLSpy as a client connected to the SchemaAgent LocalServer to create an include relationship between the following schemas provided in the include2 sub-folder of the SchemaAgentExamples\Tutorial folder:
| • | company1.xsd: This schema is structured to contain information about a company and its employees. |
| • | company2.xsd: This schema is structured to contain information about the products of a company. |
In the course of this example, you will include the address and employee components from company1.xsd in company2.xsd.
To make the components to be included into global complex types:
| 2. | Make sure that you are connected to the SchemaAgent LocalServer. |
| 3. | In XMLSpy, click the Display Diagram |

| 4. | Right-click the address element and select Make Global | Complex type from the context menu. |
A new global complex type called addressType is created.
| 5. | Click the "+" icon to expand the employees element. |

| 6. | In the same way, make the employeeData element into a global complex type. |
This results in a type called employeeDataType.
| 7. | Save the file. |
To include global complex types in schemas using XMLSpy:
| 1. | Open the target schema, company2.xsd in this example, in XMLSpy. |
| 2. | Make sure that you are connected to the SchemaAgent LocalServer. |
| 3. | In XMLSpy, click the Display Diagram |

| 4. | Right-click the sequence element and select Add child | Element from the context menu. |
| 5. | Enter "companyAddress" as the name for this element. |
| 6. | With this element still selected, in the Details entry helper, select addressType from the type drop-down list. The word "addressType" is in blue because there is no include, import or redefine relationship between the schemas. |

| 7. | A dialog box opens where you can select which type of relationship you want to have between the two schemas. |

| 8. | Select Include and confirm with OK. |
This inserts an include statement into the company2.xsd schema.
| 9. | Repeat steps 3 to 5 to create a further element with the name "employee" and of type "employeeDataType". |
Notice that when in the Details entry helper you select employeeDataType from the type drop-down list, it is in black, because there is now an include relationship between the schemas.

| 10. | Save the file. |
You have now included two types from the schema company1.xsd in the schema company2.xsd.
To view the include statement that has been inserted:
| • | Click the Display All Globals |

|