views:

17

answers:

1

Under Microsoft BizTalk 2009, we want to test the ReceivePipeline(which has a Flat file disassembler) with the built-in TestableReceivePipeline class.
It works fine if we use one single Schema, but it throws an error (System.Xml.Schema.XmlSchemaException: The 'ABC' element is not declared.) when we try to use a schema(Schema1) which has an imported schema(Schema2) inside. Why I'm getting this error?

code for testing pipeline:

        StringCollection documents = new StringCollection();
        documents.Add(@"c:\Test.dat");

        StringCollection parts = new StringCollection();

        Dictionary<string, string> schemas = new Dictionary<string, string>();
        schemas.Add("MyCompany.Schema2", @"C:\Schema2.xsd");
        schemas.Add("MyCompany.Schema1", @"C:\Schema1.xsd");

        Microsoft.BizTalk.TestTools.Pipeline.TestableReceivePipeline pipeline = new MyReceivePipeline();
        pipeline.TestPipeline(documents, parts, schemas);

Schema1.xsd source:

<xs:import schemaLocation=".\Schema2.xsd" namespace="http://MyCompany.Schema2" />
<xs:element name="Schema1">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Header">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="ClientRef" type="xs:string">
                            <xs:annotation>
                                <xs:appinfo>
                                    <b:fieldInfo justification="left" sequence_number="1" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element ref="ns1:Data" />
            <xs:element name="Tail">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="RecordCount" type="xs:int">
                            <xs:annotation>
                                <xs:appinfo>
                                    <b:fieldInfo justification="left" sequence_number="3" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>

Schema2.xsd source:

<xs:element name="Data">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="FirstName" type="xs:string" nillable="true">
                <xs:annotation>
                    <xs:appinfo>
                        <b:fieldInfo justification="left" wrap_char_type="default" sequence_number="2" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                    </xs:appinfo>
                </xs:annotation>
            </xs:element>
            <xs:element name="Surname" type="xs:string" nillable="true">
                <xs:annotation>
                    <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="3" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                    </xs:appinfo>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>

By th

A: 

AFAIK this is currently not supported in BizTalk 2009.

Bryan Corazza