Uploading Included XML Schemas

An XML Schema or WSDL document can include other XML Schemas in the main document, using Schema Inclusion, Schema Inclusion with Redefinition, or Importing a Namespace.

About this task

Schema Inclusion
You can include other XML Schema fragments into the main XML Schema or WSDL using the include element as shown by the following example: <xsd:include schemaLocation="myTypes.xsd"/>
Schema Inclusion with Redefinition
The XML Schema specification supports redefining definitions included by other XML Schema fragments in the current XML Schema or WSDL. For example, the myTypes.xsd XML Schema fragment defines a complex type called PurchaseOrderType. Another XML Schema called PurchaseOrder.xsd includes the myTypes.xsd XML Schema fragment using the redefine element and redefines the complex type called PurchaseOrderType.
You can include other XML Schema fragments into the main XML Schema or WSDL using the redefine element as shown in the following example: <xsd:redefine schemaLocation="myTypes.xsd"/>
Importing a Namespace
You can include a namespace into the current document using the import element as shown in the following example: <xs:import namespace="http://acme.com/ns/example schemaLocation="mySchema.xsd" /> .

When you add or upload the main XML Schema or WSDL to the project using the Add Document dialog box, you are prompted to locate any included XML Schema or XML Schemas into the project, as shown in the following procedure. All the included XML Schemas must be located before the main XML Schema or WSDL document shows in the Project tab and can be used in the project.

Procedure

  1. Upload an XML Schema or WSDL document into the current project. If the XML Schema or WSDL document includes other XML Schemas, the Uploading Included XML Schemas dialog box displays listing all the included XML Schemas as shown in Figure 1.
    Figure 1. Uploading Included XML SchemasUpload an XML Schema
    If the included XML Schema is automatically located, the checkmark icon Checkmark icon displays next to the XML Schema in the Uploading Included XML Schemas dialog box as shown for the commonTypes.xsd XML Schema in the preceding figure. If the main XML Schema or WSDL was located on the local file system, Studio looks for the included XML Schemas in the same directory and automatically locates them; for example, if you uploaded mySchema.xsd from the C:\temp directory and mySchema.xsd includes the commonTypes.xsd XML Schema, Studio automatically locates the commonTypes.xsd XML Schema in the C:\temp directory. If the included XML Schema is not automatically located, the warning icon Warning icon displays next to the XML Schema in the Uploading Included XML Schemas dialog box as shown for the poTypes.xsd XML Schema in Figure 1.
  2. Repeat the following steps to locate all the unlocated XML Schemas:
    1. Select the XML Schema in the Uploading Included XML Schemas dialog box. The XML Schema is highlighted in the table as shown in Figure 2.
      Figure 2. Upload an XML SchemaUpload an XML Schema
    2. Click Locate.   The Locate the Selected XML Schema dialog box is displayed.
    3. In the Location field, specify the location of the included XML Schema from an external web location or from the file system.
    4. Click OK.   If the XML Schema is located, the checkmark icon Checkmark icon displays next to the XML Schema in the Uploading Included XML Schemas dialog box.
  3. By default, the Store all the includes in the same project node as the main document check box is selected. When this check box is selected, the included XML Schemas and the main XML Schema or WSDL are uploaded as a single project node. When this check box is cleared, all the included XML Schemas and the main XML Schema or WSDL are all displayed separately in the Project tab. A checkmark icon shows next to every listed XML Schema indicating that all the included XML Schemas have been located.
  4. Click OK.

Example

If the Store all the includes in the same project node as the main document check box is selected, only the main XML Schema or WSDL displays in the Project tab as shown in Figure 3.
Figure 3. ExampleExample

With the check box selected, the included XML Schemas are still uploaded into the project but are not displayed in the Project tab, so you cannot individually update these XML Schemas in the project as described in Uploading Included XML Schemas.

If the Store all the includes in the same project node as the main document check box is cleared, the main XML Schema or WSDL displays and all the included XML Schemas are uploaded in the project and show in the Project tab as shown in Figure 4.
Figure 4. ExampleExample

With the check box cleared, all the included XML Schemas can be individually updated as described in Uploading Included XML Schemas.

Note: If possible, always load the main XML Schema or WSDL with this check box selected (as one project node) to reduce potential dependency conflicts between XML Schemas. For example, if you upload the main myTypes.xsd file into the project with the Store all the includes in the same project node as the main document check box cleared, the following XSD files are also uploaded and show in the Project tab:
  • commonTypes.xsd
  • poTypes.xsd

If you created and uploaded a third XSD file called myTypesTwo.xsd that also included and used the types defined in the commonTypes.xsd file, and you then changed the names of the types defined in the commonTypes.xsd and used in myTypes.xsd outside of Studio and uploaded new versions these files, the myTypesTwo.xsd file in the project still refers to the original names of the types and is now invalid.




Feedback | Notices


Timestamp icon Last updated: Tuesday, 27 September 2016


http://pic.dhe.ibm.com/infocenter/wci/v7r0m0/topic/com.ibm.wci.doc/Uploading_Included_XML_Schemas.html