使用平面文件反汇编程序开发自定义接收管道 [英] Developing a Custom Receive Pipeline with Flat File Disassembler

查看:77
本文介绍了使用平面文件反汇编程序开发自定义接收管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.txt文件,其格式与以下类似

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

1115151651515950000055 00012913702613000000000003000 139C0000007000000
1215151651121510000054 00022913803603000000000009000 000279A0000009000
1315115950000065516515 00032813104643000000000007000 000399B0000003000
121515160003290003290000010000000003000

1115151651515950000055 00012913702613000000000003000 139C0000007000000
1215151651121510000054 00022913803603000000000009000 000279A0000009000
1315115950000065516515 00032813104643000000000007000 000399B0000003000
121515160003290003290000010000000003000

前3行是body元素,但是body部分中的行数是未知的(可能从1到无界).正文部分没有标签标识符.文件中的最后一行始终是预告片.在分析之前,应删除文件中的预告片,以便仅对记录进行分析.如何使用平面文件反汇编器中的管道组件来完成此操作.

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.

推荐答案

您不需要删除预告片. 您需要它来定义平面文件架构,在该架构中可以不受限制地出现正文记录,并为拖车提供单独的记录. 您必须在以下示例中在Root上设置定界符,Child Delimiter = 0x0D 0x0A(CR LF),Child Delimiter Type = Hexadecimal,Child Order = Infix,但这可能会有所不同,您必须声明正确的定界符以及其中的位置发生.对于以上文件,我假设预告片后没有CR LF,因此如果最后一行确实具有CR LF,则选择Infix(分隔符出现在中间)而不是Postfix(分隔符出现在之后).

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>

这篇关于使用平面文件反汇编程序开发自定义接收管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆