XML schema provides Import, Include, and Redefine (IIR) statements to help modularize schemas. Each method has different namespace requirements. These requirements are automatically checked by SchemaAgent Client and XMLSpy when you try to create IIRs.
Schema constructs can be "inserted" by different methods:
•Global elements can be dragged directly from the Components Entry Helper into the content model of a schema component (in Schema View).
•Components, such as complexTypes and simpleTypes, can be selected from the list box that automatically opens when defining new elements/attributes, etc.
•Components, such as complexTypes, can be selected from the Details Entry Helper when creating/updating these type of constructs.
This example uses the DB2schema.xsd file available in the ..\Tutorial folder as the active schema; the Global tab of the Components Entry Helper is active.
To use schema constructs from SchemaAgent Server schemas:
|1.||Make sure you are connected to a SchemaAgent server (see Connecting to SchemaAgent server).|
|2.||Open and rename the DB2Schema.xsd file for this example, for example to Altova-office.|
|3.||Click the icon of the Altova element in the Schema Overview to see its content model.|
|4.||Right-click the Altova sequence compositor and select the menu option Add Child | Element. Note that a list box containing all global elements within the server path opens automatically at this point. Selecting one would incorporate that element.|
|5.||Enter Altova-office as the name for this new element and press Enter.|
|6.||Using the Details Entry Helper, click the type combo box and select the entry OfficeType.|
This opens the Select Definition For OfficeType dialog box.
|7.||Select Orgchart.xsd and click OK to confirm.|
|8.||Click OK. The Import command was automatically selected for you. An expand icon appears in the Altova-office element.|
Please note: The type entry in the Details entry helper has changed; it is now displayed as ns1:OfficeType due to the fact that the Orgchart.xsd schema file has been imported and the target namespaces must be different in both schemas. An Import command has also been added to the schema.
|9.||Click the Expand button to see the OfficeType content model.|
|10.||Press F8 to validate the schema. The "Schema is valid" message should appear at this stage.|
|1.||Delete the Division element in the content model.|
|2.||Click the Return to globals icon to switch to the Schema Overview.|
|3.||Delete the following global elements: Division, Person and VIP.|
|4.||Select the menu option Schema Design | Schema settings to see how the namespace settings have changed.|
The ns1 prefix has been automatically added to the www.xmlspy.com/schemas/orgchart namespace. The Components (see screenshot) and Details Entry Helpers displays all imported constructs with the ns1: namespace prefix.
•Changes made to schemas under SchemaAgent Server control using XMLSpy automatically update other schemas in the SchemaAgent Server path that referenced the changed schema.
•It is possible to see duplicates of constructs element, simpleTypes etc. in entry helpers (in black and blue), if the schema you are working on is also in the SchemaAgent Server path.