Preserve trailing spaces in flat file schema

If the trailing spaces of your flat file message is being truncated by BizTalk then the workaround to this is add the (pad_char_type="none" ) attribute to the (schemainfo and fieldinfo) tags.I used the flat file schema wizard to generate the schema. Before modification my schema looked like this.

 

<xs:schema xmlns="” targetNamespace=" ">

  <xs:annotation>

    <xs:appinfo>

      <b:schemaInfo standard="Flat File" codepage="65001" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="complexity" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="true" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="RecordNode" />

    </xs:appinfo>

  </xs:annotation>

  <xs:element name="RecordNode">

    <xs:annotation>

      <xs:appinfo>

        <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="postfix" 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>

            <b:groupInfo sequence_number="0" />

          </xs:appinfo>

        </xs:annotation>

        <xs:element maxOccurs="unbounded" name="RecordField" type="xs:string">

          <xs:annotation>

            <xs:appinfo>

              <b:fieldInfo justification="left" sequence_number="1" />

            </xs:appinfo>

          </xs:annotation>

        </xs:element>

      </xs:sequence>

    </xs:complexType>

  </xs:element>

</xs:schema

 

After modification my schema changed to this.

 

<xs:annotation>

    <xs:appinfo>

     <b:schemaInfo standard="Flat File" codepage="65001" pad_char_type="none" count_positions_by_byte="false" parser_optimization="complexity" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="true" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="RecordNode" />

    </xs:appinfo>

  </xs:annotation>

  <xs:element name="RecordNode">

    <xs:annotation>

      <xs:appinfo>

        <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="postfix" 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>

            <b:groupInfo sequence_number="0" />

          </xs:appinfo>

        </xs:annotation>

        <xs:element maxOccurs="unbounded" name="RecordField" type="xs:string">

          <xs:annotation>

            <xs:appinfo>

              <b:fieldInfo justification="left" sequence_number="1" pad_char_type="none" />

            </xs:appinfo>

          </xs:annotation>

        </xs:element>

      </xs:sequence>

    </xs:complexType>

  </xs:element>

</xs:schema>