命名空间“*”中的元素 'Send' 在命名空间“*”中具有无效的子元素 'Add_Records'。地图文件的测试地图失败

The element 'Send' in namespace '*' has invalid child element 'Add_Records' in namespace '*'. Test Map failure for map file

我有以下输入文件:

H|3      |20110607235508
V|M065      |3077999   |NH|PAS|20110608|213400|M| |   
V|M006      |EUR8944   |NY|PAS|20110608|213547|M| |   
V|M057      |UNV39S    |NJ|PAS|20110608|213908|M| |  
T|3      |20110607235508

我有这个模式

<xs:schema xmlns="http://BizTalkNyCase.Schemas.CaseFileSchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://BizTalkNyCase.Schemas.CaseFileSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
  <xs:appinfo>
  <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" /> 
  <b:schemaInfo standard="Flat File" codepage="65001" default_pad_char="" pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="CaseFileSchema" /> 
  </xs:appinfo>
  </xs:annotation>
  <xs:element name="CaseFileSchema">
  <xs:annotation>
  <xs:appinfo>
  <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" /> 
  </xs:appinfo>
  </xs:annotation>
  <xs:complexType>
  <xs:sequence>
  <xs:annotation>
  <xs:appinfo>
  <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" /> 
  </xs:appinfo>
  </xs:annotation>
  <xs:element name="CaseHeader" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="1" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element minOccurs="3" maxOccurs="3" name="CaseRecords">
  <xs:annotation>
  <xs:appinfo>
  <b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="infix" sequence_number="2" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" /> 
  </xs:appinfo>
  </xs:annotation>
  <xs:complexType>
  <xs:sequence>
  <xs:annotation>
  <xs:appinfo>
  <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" /> 
  </xs:appinfo>
  </xs:annotation>
  <xs:element name="Vehicle" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="1" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element name="Officer_Id" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="2" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element name="Vehicle_Tag" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="3" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element name="State" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="4" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element name="Vehicle_Type" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="5" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element name="TowDate" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="6" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element name="TowTime" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="7" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element name="TowType" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="8" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element name="TowIndicator" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="9" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  <xs:element name="Precinct" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="10" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  <xs:element name="CaseTrailer" type="xs:string">
  <xs:annotation>
  <xs:appinfo>
  <b:fieldInfo justification="left" sequence_number="3" /> 
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:schema>

这是输出架构

<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://SqlAdapterCase" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
  <xs:appinfo>
  <msbtssql:sqlScript value="exec [Add_Records] @OfficerId=" ", @Precinct=" ", @State=" ", @TowDate=" ", @TowIndicator=" ", @TowTime=" ", @TowType=" ", @Vehicle=" ", @VehicleTag=" ", @VehicleType=" "" xmlns:msbtssql="http://schemas.microsoft.com/BizTalk/2003" /> 
  </xs:appinfo>
  </xs:annotation>
  <xs:element name="Send">
  <xs:complexType>
  <xs:sequence>
  <xs:element name="Add_Records">
  <xs:complexType>
  <xs:attribute name="OfficerId" type="xs:string" /> 
  <xs:attribute name="Precinct" type="xs:string" /> 
  <xs:attribute name="State" type="xs:string" /> 
  <xs:attribute name="TowDate" type="xs:string" /> 
  <xs:attribute name="TowIndicator" type="xs:string" /> 
  <xs:attribute name="TowTime" type="xs:string" /> 
  <xs:attribute name="TowType" type="xs:string" /> 
  <xs:attribute name="Vehicle" type="xs:string" /> 
  <xs:attribute name="VehicleTag" type="xs:string" /> 
  <xs:attribute name="VehicleType" type="xs:string" /> 
  </xs:complexType>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  <xs:element name="Recive">
  <xs:complexType>
  <xs:sequence>
  <xs:element name="Success" type="xs:anyType" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:schema>

然而,当我测试地图时出现此错误

as input to the map. C:\Users\Administrator\Desktop\error.xml: error btm1046: Output validation error: The element 'Send' in namespace 'http://SqlAdapterCase' has invalid child element 'Add_Records' in namespace 'http://SqlAdapterCase'. Test Map failure for map file

查看您的地图 and/or 输出消息以完整回答此问题很重要,但查看您的输出架构,所有值都是必需的(未指定 minOccurs,这表示它默认为 1).

您有几个选择:

  1. 如果确实不需要某些节点并且您希望您的模式与此一致,请更新您的模式,以便 attributes/elements 不需要的节点具有 minOccurs="0"
  2. 更新您的地图,以便它为所有需要的 nodes/attributes(目前,所有这些)提供有效输出。即使是空字符串(或将节点 Value 属性 设置为 <Empty> 也可以)。
  3. 关闭映射器上的验证。我通常这样做 - 很多时候,开发人员不会费心设置 minOccurs="0",并且 BizTalk 运行时不会执行验证检查,除非您专门使用验证管道组件(或其他一些自定义验证组件)。地图单元测试通常更关心其他事情,而不是是否遵循所有模式规则默认情况下,这些属性设置为 True - 将其更改为 false。如果您想再次验证,可以随时将其改回。