rracca
rracca

Reputation: 35

XSD and SSIS: Error finding globally declared complex type

I finished writing my XSD for my XML and when I started to map it in SSIS, I've encountered an error saying: "There was an error setting up the mapping. Type '[my globally declared complex type]' is not declared.".

So, I tried to look for proper ways on declaring a global complex type that I can re-use such as an Address Block. I moved the complex type block on different places such as directly a child of the schema node, right before the element node of the one I'm referencing and a lot more. But, it all still lead back to the same error.

This is a sample format of my XSD:

<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:Search" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="RESPONSE">
        <xs:complexType>
            <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="unbounded" name="ABC">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" maxOccurs="1" name="Bus" type="Bus" />
                    </xs:sequence>
                </xs:complexType>
             </xs:element>
             </xs:sequence>
         </xs:complexType>
     </xs:element>

     <xs:complexType name="Bus">
        <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="BusType" type="xs:string" />
        <xs:element minOccurs="0" maxOccurs="1" name="BusSubType" type="xs:string" />
        <xs:element minOccurs="0" maxOccurs="1" name="Date" type="xs:string" />
        <xs:element minOccurs="1" maxOccurs="1" name="Franchise" type="xs:boolean" />
        <xs:element minOccurs="0" maxOccurs="1" name="Name" type="xs:string" />
        <xs:element minOccurs="0" maxOccurs="1" name="OperatingSince" type="xs:string" />
        </xs:sequence>
     </xs:complexType>
</xs:schema> 

I'm expecting to map the XML properly with this XSD format that I made.

Thanks a lot to everyone making time to read and/or help me out with this!

Upvotes: 2

Views: 157

Answers (1)

Michael Kay
Michael Kay

Reputation: 163272

It's a namespace issue. The global type is in the targetNamespace of the containing schema document, whereas type="Bus" is a reference to a type in no namespace. It needs to be type="s:Bus" where prefix s is bound to URI urn:Search

Upvotes: 2

Related Questions