Reputation: 34008
I have the following input 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
And I have this schema
<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>
and this is the output 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>
However when I test the map I get this error
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
Upvotes: 0
Views: 1719
Reputation: 21651
It'd be important to see your map and/or the output message to fully answer this question, but looking at your output schema, all values are required (minOccurs
is not specified, which means it's defaulted to 1).
You have a few options:
minOccurs="0"
on them.Value
property to <Empty>
will work).minOccurs="0"
, and the BizTalk runtime won't do the validation checking unless you specifically use the validating pipeline component (or some other custom validating component). Map unit testing is usually more concerned with other things rather than whether all schema rules are being followed By default, these properties are set to True - change that to false. You can always change it back later if you want to validate again.Upvotes: 3