Click here to Skip to main content
Click here to Skip to main content

Preserve trailing spaces in a flat file schema

, 2 May 2009
Rate this:
Please Sign up or sign in to vote.
If the trailing spaces of your flat file message is being truncated by BizTalk, here is a workaround.

If the trailing spaces of your flat file message is being truncated by BizTalk, then the workaround to this is to 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="" 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="" 
                sequence_number="1" pad_char_type="none" />
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Abdul_Rafay
Architect
Qatar Qatar
I am a BizTalk Server MVP for 2010 and an active blogger and a participant on the MSDN BizTalk Server Forums. I am currently working as a BizTalk Architect at a Bank in Qatar. Before this position I worked as a Sharepoint Consultant in UAE , BizTalk Architect in Bank Saudi Fransi in Saudi Arabia and United Bank Ltd in Pakistan.
 
I also achieved MCTS certification in BizTalk Application development in June 2008.
 
Click here to check out my Blog.

SQL Server Query Notification with BizTalk Server 2009 WCF SQL Adapter.

Envelope Wrapper.

Aggregator (Sequential Convoy)

Splitter (Debatching multiple records)
Resequencer
Recipient List
Scatter and Gather using Self Correlating Port

Comments and Discussions

 
QuestionQuestion about truncated spaces but in a bistalk mapper. PinmemberHenkhell Pedroza25-Jun-09 9:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 2 May 2009
Article Copyright 2009 by Abdul_Rafay
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid