82831

Developing a Custom Receive Pipeline with Flat File Disassembler

Question:

I have a .txt file which is in the similar format as below

1115151651515950000055 00012913702613000000000003000 139C0000007000000<br /> 1215151651121510000054 00022913803603000000000009000 000279A0000009000<br /> 1315115950000065516515 00032813104643000000000007000 000399B0000003000<br /> 121515160003290003290000010000000003000

The first 3 lines are body elements but the number of lines in the body part will be unknown(may occur from 1 to unbounded). There is no tag identifier in body part. The last line in the file is always a trailer.The trailer from the file is to be removed prior to parsing so that only the records need parsed. How can this be done using a Pipeline Component in the Flat File Disassembler.

Answer1:

You should not need to remove the trailer. What you need it to define a Flat File Schema where the Body Record can occur unbounded and a separate record for the trailer. You have to set the the delimiters on the Root in the example below, Child Delimiter = 0x0D 0x0A (CR LF), Child Delimiter Type = Hexadecimal, Child Order=Infix, but that may vary and you have to declare the correct delimiter and where the occur. For the above file I assumed that there was no CR LF after the trailer, hence chose Infix (delimiter occurs between) rather than Postfix (delimiter occurs after) if the last line does have a CR LF.

You can then define the Body and Trailer Structure to be either Delimited or Positional.

Update: To not have the trailer in the message to be processed, have a map on the receive port that only maps the Body records and not the trailer.

<?xml version="1.0" encoding="utf-16"?> <xs:schema xmlns="http://Scratch.FlatFile" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.FlatFile" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:appinfo> <b:schemaInfo standard="Flat File" root_reference="Root" 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" /> <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" /> </xs:appinfo> </xs:annotation> <xs:element name="Root"> <xs:annotation> <xs:appinfo> <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="infix" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" /> </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="Body"> <xs:annotation> <xs:appinfo> <b:recordInfo sequence_number="1" structure="delimited" 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 name="BodyContents" type="xs:string"> <xs:annotation> <xs:appinfo> <b:fieldInfo sequence_number="1" justification="left" /> </xs:appinfo> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Trailer"> <xs:annotation> <xs:appinfo> <b:recordInfo sequence_number="2" structure="delimited" 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 name="TrailerContents" type="xs:string"> <xs:annotation> <xs:appinfo> <b:fieldInfo sequence_number="1" justification="left" /> </xs:appinfo> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>

Recommend

  • Arduino Sim900 with no echo but SMS was sent out
  • How to use infix operator from a SML module?
  • COLUMNS_UPDATED() return different values when ColumnId is the same
  • No bootloader found on bootable medium
  • Passing a sequence of bits to a file python
  • C - long double and printf issue
  • Converting/writing a BufferedImage to postscript
  • implementing stack with linked list in C
  • CSVParser processes LF as CRLF
  • Bash: How to do a variable expansion within an arithmetic expression?
  • Converting fractions into hexadecimal
  • Where is the source for: “Function application has higher precedence than infix operators” [Haskell]
  • Convert rgba colour definition string in LESS to color instance
  • Infix format for Nemerle macro
  • R. how to make matrix which have equal rows
  • set ruby hash element value by array of keys
  • Hide UIView starting from Bottom on Scroll
  • Getting rollback in creating shortcuts on installation of node js in windows 7
  • Google Contacts API asp.net settings and authorization token
  • Retrieve google contact based on contact Id
  • LDA: Why sampling for inference of a new document?
  • How do I chomp a string if I have Perl 4?
  • Will cin recognize \\n typed in from keyboard as a newline character?
  • Vim folding : how to hide all the single lines not containing a search pattern (or fold zero line)?
  • mapping between two ontologies
  • Need code translation from VB to C#
  • Best practice to eliminate magic numbers within a member function
  • Eliminate partial duplicate rows from result set
  • Breeze - Deleted Items nav properties bug
  • javaw.exe and eclipse startup problems
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How to set the response of a form post action to a iframe source?
  • How do I configure my settings file to work with unit tests?
  • Change div Background jquery
  • need help with bizarre java.net.HttpURLConnection behavior
  • Qt: Run a script BEFORE make
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • reshape alternating columns in less time and using less memory
  • Binding checkboxes to object values in AngularJs