Import XSD data definition file into another XSD file

  • I have a project that makes use of several XSD files for various operations. Each of the XSD files uses common data type definitions. My plan was to create an XSD with the type definitions and include it in all of the other XSD files. Being that <xs:include> is not supported in 2005, I am attempting to use import. The import statement appears to be fine, but the creation of the collection fails not finding my type definitions.

    The XSD file with my type definitions is of the format:

    <?xml version="1.0" ?>

    <xs:schema attributeFormDefault="unqualified"

    xmlns:tns="http://schemas.xmlsoap.org/wsdl/"

    targetNamespace="mySpace"

    xmlns="mySpace"

    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:simpleType name="personDef">

    <xs:restriction base="xs:string"/>

    </xs:simpleType>

    ..... more type definitions........

    </xs:schema>

    My XSD file in which I want to use the definition those type definitions is of the format:

    <?xml version="1.0" ?>

    <xs:schema attributeFormDefault="unqualified"

    xmlns:tns="http://schemas.xmlsoap.org/wsdl/"

    xmlns:t="mySpace"

    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:import namespace="mySpace"/>

    <xs:element minOccurs="0" name=person type="t:personDef"/>

    </xs:schema>

    The error is:

    Reference to an undefined name 'personDef' within namespace 'mySpace'

    I do not have too much experience with import usage, but I thought this syntax was correct.

    Any help would be appreciated.

Viewing post 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply