在Microsoft BizTalk 2009下,我们希望使用内置的TestableReceivePipeline类测试ReceivePipeline(具有Flat文件反汇编程序)。 如果我们使用一个Schema,它可以正常工作,但是当我们尝试使用具有导入模式的模式(Schema1)时,它会抛出一个错误(System.Xml.Schema.XmlSchemaException:'ABC'元素未被声明。) Schema2)里面。 为什么我收到这个错误?
测试管道的代码:
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来源:
<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源:
<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>
答案 0 :(得分:0)
AFAIK目前BizTalk 2009不支持此功能。