Stylus Studio XML Editor

Table of contents

Appendices

3.1 Using W3C XML Schema Description Language

Using W3C XML Schema Description Language

XML Schema MAY be used as the schema language via import or embedding. Each method defines a different element information item for use within a types element information item. All processors MUST support XML Schema type definitions.

A WSDL description MUST NOT refer to XML Schema components in a given namespace unless an xs:import and/or xs:schema statement for that namespace is present. That is, using the xs:import and/or xs:schema constructs is a necessary condition for making XML Schema components available to a WSDL description.

Importing XML Schema[top]

Importing XML Schema

Importing an XML Schema uses the syntax and semantics of the xs:import mechanism defined by XML Schema [XMLSchemaP1],[XMLSchemaP2], with some additional restrictions. The schema components defined in the imported schema are available for reference by QName (see [QName resolution]). Note that only components defined in the schema itself and components included by it via xs:include are available to WSDL. Specifically, components that the schema imports via xs:import are NOT available to WSDL.

A child element information item of the types element information item is defined with the Infoset properties as follows:

  • A [local name] of import.

  • A [namespace name] of http://www.w3.org/2001/XMLSchema.

  • One or two attribute information items as follows:

    • A REQUIRED namespace attribute information item as described below.

    • An OPTIONAL schemaLocation attribute information item as described below.

namespace attribute information item[top]

namespace attribute information item

The namespace attribute information item defines the namespace of the element declarations and type definitions imported from the referenced schema. The referenced schema MUST contain a targetNamespace attribute information item on its xs:schema element information item and the values of these two attribute information items MUST be identical. It is an error to import a schema that does not have a targetNamespace attribute information item on its xs:schema element information item. Such schemas must first be included (using xs:include) in a schema that contains a targetNamespace attribute information item on its xs:schema element information item, which can then be either imported or inlined in the WSDL document.

The namespace attribute information item has the following Infoset properties:

  • A [local name] of namespace

  • A [namespace name] which has no value.

The type of the namespace attribute information item is xs:anyURI.

schemaLocation attribute information item[top]

schemaLocation attribute information item

The schemaLocation attribute information item, if present, provides a hint to the processor as to where the schema may be located. Caching and cataloging technologies may provide better information than this hint. The schemaLocation attribute information item has the following infoset properties:

  • A [local name] of schemaLocation.

  • A [namespace name] which has no value.

The type of the schemaLocation attribute information item is xs:anyURI.

Embedding XML Schema[top]

Embedding XML Schema

Embedding an XML schema uses the existing top-level xs:schema element information item defined by XML Schema [XMLSchemaP1]. It may be viewed as simply cutting and pasting an existing, stand-alone schema, to a location inside the types element information item.

The schema components defined in the embedded schema are available to WSDL for reference by QName (see [QName resolution]). Note that only components defined in the schema itself and components included by it via xs:include are available to WSDL. Specifically components that the schema imports via xs:import are NOT available to WSDL.

Similarly, components defined in an embedded XML schema are NOT automatically made available to a WSDL description that imported (using wsdl:import) the description that embeds the schema (see [Importing Descriptions] for more details). For this reason, it is recommended that XML schema documents intended to be shared across several WSDL descriptions be placed in separate documents and imported using xs:import, rather than embedded inside a WSDL document.

Inside an embedded XML schema, the xs:import and xs:include element information items MAY be used to refer to other XML schemas embedded in the same WSDL description, provided that an appropriate value is specified for their schemaLocation attribute information items. The semantics of such element information items are governed solely by the XML Schema specification [XMLSchemaP1].

The xs:schema element information item has the following Infoset properties:

  • A [local name] of schema.

  • A [namespace name] of http://www.w3.org/2001/XMLSchema.

  • A REQUIRED targetNamespace attribute information item, amongst its [attributes] as described below.

  • Additional OPTIONAL attribute information items as specified for the xs:schema element information item by the XML Schema specification.

  • Zero or more child element information items as specified for the xs:schema element information item by the XML Schema specification.

targetNamespace attribute information item[top]

targetNamespace attribute information item

The targetNamespace attribute information item defines the namespace of the element declarations and type definitions embedded in its [owner] xs:schema element information item. WSDL modifies the XML Schema definition of the xs:schema element information item to make this attribute information item required. The targetNamespace attribute information item has the following infoset properties:

  • A [local name] of targetNamespace.

  • A [namespace name] which has no value.

The type of the targetNamespace attribute information item is xs:anyURI.

References to Element Declarations and Type Definitions[top]

References to Element Declarations and Type Definitions

Whether embedded or imported, the element declarations present in a schema may be referenced from a Message Reference or Interface Fault component. Similarly, regardless of whether they are embedded or imported, the type definitions present in a schema may be referenced from a Property component.

A named, global xs:element declaration may be referenced from the element attribute information item of an input, output or fault element information item. The QName is constructed from the targetNamespace of the schema and the value of the name attribute information item of the xs:element element information item. An element attribute information item MUST NOT refer to a global xs:simpleType or xs:complexType definition.

A named, global xs:simpleType or xs:complexTypedeclaration may be referenced from the constraint attribute information item of property element information item. The QName is constructed from the targetNamespace of the schema and the value of the name attribute information item of the xs:simpleType or xs:complexType element information item. A constraint attribute information item MUST NOT refer to a global xs:element definition.