使用平面文件反汇编程序开发自定义接收管道

时间:2014-08-20 16:26:46

标签: biztalk biztalk-2010

我有一个.txt文件,格式如下

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

前3行是身体元素,但身体部位的行数将是未知的(可能从1到无界)。身体部位没有标签标识符。文件中的最后一行始终是预告片。在解析之前要删除文件中的预告片,以便只需要解析记录。如何使用Flat File Disassembler中的Pipeline Component完成此操作。

1 个答案:

答案 0 :(得分:0)

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

然后,您可以将Body和Trailer Structure定义为Delimited或Positional。

更新:要在要处理的邮件中没有预告片,请在接收端口上设置一个仅映射主体记录而不是预告片的地图。

<?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>
相关问题