xs:include

Purpose

This element is used to make additional definitions from included schema for the same namespace visible in the including schema.

In Tamino, an xs:include element must resolve to a schema already defined in the same database. The schemaLocation attribute specifies the location of the schema.

For example, to include a schema IncludedSchema.tsd, specify an xs:include element with the following schemaLocation attribute value:

../<collection name>/IncludedSchema.tsd

where <collection name> is the name of the collection containing the referenced schema.

Notes:

  1. There can be an arbitrary number of xs:include elements, in order to compose a set of schema documents for the same target namespace.
  2. For more information about including other schemas, refer to the W3C XML Schema documentation, especially the section Assembling a schema for a single target namespace from multiple schema definition documents.
Parent element xs:schema
Child elements None
Attributes schemaLocation
Restrictions Tamino does not import the chameleon include (see http://www.w3.org/2001/05/xmlschema-rec-comments.html#pfiIdConstInclude. Chameleon include means that a schema "S2" without a target namespace is included into a schema "S1" with a target namespace, whereby the included schema "S2" inherits the target namespace of "S1".
Attributes
Name Type Description
schemaLocation xs:anyURI

To locate a schema stored in the same database the structure of the schemaLocation attribute can be any of the following:

  • ../collectionName/schemaName

  • ./schemaName

  • schemaName

Note:
./schemaName and schemaName are always equivalent.

Example

The following schema, entitled "master", uses an xs:include element to include the schema entitled "slave".

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:tsd="http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition">
  <xs:annotation>
    <xs:appinfo>
      <tsd:schemaInfo name="master">
        <tsd:collection name="include"/>
        <tsd:doctype name="types">
          <tsd:logical>
            <tsd:content>closed</tsd:content>
          </tsd:logical>
        </tsd:doctype>
      </tsd:schemaInfo>
    </xs:appinfo>
  </xs:annotation>
  <xs:include schemaLocation="slave"/>
</xs:schema>

The following schema is the "slave" schema, which is included by the "master" schema shown above.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:tsd="http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition">
  <xs:annotation>
    <xs:appinfo>
      <tsd:schemaInfo name="slave">
        <tsd:collection name="include"/>
      </tsd:schemaInfo>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="types">
    <xs:complexType>
      <xs:choice minOccurs="1" maxOccurs="unbounded">
        <xs:element name="decimal" type="xs:decimal">
          <xs:annotation>
            <xs:appinfo>
              <tsd:elementInfo>
                <tsd:physical>
                  <tsd:native>
                    <tsd:index>
                      <tsd:standard/>
                    </tsd:index>
                  </tsd:native>
                </tsd:physical>
              </tsd:elementInfo>
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>