Using IIRs

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  User Guide and Reference > DTDs and XML Schemas > Working with SchemaAgent >

Using IIRs

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.

 

Imports, Includes, and Redefines (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.

 

Incorporating schema components

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.

spy-client01

 

3.Click the ic_schem_part 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.

spy-client1

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.

spy-client2

This opens the Select Definition For OfficeType dialog box.

spy-client3

7.Select Orgchart.xsd and click OK to confirm.

spy-client4

8.Click OK. The Import command was automatically selected for you. An expand icon appears in the Altova-office element.

spy-client3a

 

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.

spy-client5

 

9.Click the Expand button to see the OfficeType content model.

spy-client6

 

10.Press F8 to validate the schema. The "Schema is valid" message should appear at this stage.

 

Cleaning up the schema:

 

1.Delete the Division element in the content model.
2.Click the Return to globals icon ic_back2global to switch to the Schema Overview.
3.Delete the following global elements: Division, Person and VIP.

spy-client7

4.Select the menu option Schema Design | Schema settings to see how the namespace settings have changed.

spy-ins-construct5

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.

spy-client8

 

Please note:

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.

 


© 2019 Altova GmbH