且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

BizTalk FlatFile架构多个重复记录

更新时间:2023-02-02 22:19:54

以下模式有效(您需要将我的字符串元素更改为正确的位置记录).

The following schema works (you of cause need to change my string elements to the correct positional record).

您需要做的是:

  1. 在平面文件向导之后添加一条记录.
  2. 将记录放在FDR元素之后.
  3. 将重复记录DEC ADD添加到此新记录中作为子元素.
  4. 将记录设置为未绑定
  5. 设置子订单中缀
  6. 子定界符类型为十六进制
  7. 子定界符为0x0D 0x0A

这将为您提供以下架构:

This gives you the following schema:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://FlatFileSchema4" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://FlatFileSchema4" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:annotation>
        <xs:appinfo>
            <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
            <b:schemaInfo standard="Flat File" codepage="65001" 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" root_reference="Root" />
        </xs:appinfo>
    </xs:annotation>
    <xs:element name="Root">
        <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>
                        <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                    </xs:appinfo>
                </xs:annotation>
                <xs:element name="FDR">
                    <xs:annotation>
                        <xs:appinfo>
                            <b:recordInfo structure="positional" tag_name="FDR" tag_offset="0" 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>
                                    <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                            <xs:element name="FDR" type="xs:string">
                                <xs:annotation>
                                    <xs:appinfo>
                                        <b:fieldInfo justification="left" pos_offset="0" pos_length="35" sequence_number="1" />
                                    </xs:appinfo>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="HDR">
                    <xs:annotation>
                        <xs:appinfo>
                            <b:recordInfo structure="positional" tag_name="HDR" tag_offset="0" sequence_number="2" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
                        </xs:appinfo>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:annotation>
                                <xs:appinfo>
                                    <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                            <xs:element name="HDR" type="xs:string">
                                <xs:annotation>
                                    <xs:appinfo>
                                        <b:fieldInfo justification="left" pos_offset="0" pos_length="29" sequence_number="1" />
                                    </xs:appinfo>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element maxOccurs="unbounded" name="RR">
                    <xs:annotation>
                        <xs:appinfo>
                            <recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="3" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" child_order="infix" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                        </xs:appinfo>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:annotation>
                                <xs:appinfo>
                                    <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                            <xs:element name="DET">
                                <xs:annotation>
                                    <xs:appinfo>
                                        <b:recordInfo structure="positional" tag_name="DET" tag_offset="0" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" />
                                    </xs:appinfo>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:annotation>
                                            <xs:appinfo>
                                                <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                                            </xs:appinfo>
                                        </xs:annotation>
                                        <xs:element name="DET" type="xs:string">
                                            <xs:annotation>
                                                <xs:appinfo>
                                                    <b:fieldInfo justification="left" pos_offset="0" pos_length="482" sequence_number="1" />
                                                </xs:appinfo>
                                            </xs:annotation>
                                        </xs:element>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="ADD">
                                <xs:annotation>
                                    <xs:appinfo>
                                        <b:recordInfo structure="positional" tag_name="ADD" tag_offset="0" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="2" />
                                    </xs:appinfo>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:annotation>
                                            <xs:appinfo>
                                                <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                                            </xs:appinfo>
                                        </xs:annotation>
                                        <xs:element name="ADD" type="xs:string">
                                            <xs:annotation>
                                                <xs:appinfo>
                                                    <b:fieldInfo justification="left" pos_offset="0" pos_length="41" sequence_number="1" />
                                                </xs:appinfo>
                                            </xs:annotation>
                                        </xs:element>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="TRL">
                    <xs:annotation>
                        <xs:appinfo>
                            <b:recordInfo structure="positional" tag_name="TRL" tag_offset="0" sequence_number="4" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
                        </xs:appinfo>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:annotation>
                                <xs:appinfo>
                                    <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                            <xs:element name="TRL" type="xs:string">
                                <xs:annotation>
                                    <xs:appinfo>
                                        <b:fieldInfo justification="left" pos_offset="0" pos_length="81" sequence_number="1" />
                                    </xs:appinfo>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="END">
                    <xs:annotation>
                        <xs:appinfo>
                            <b:recordInfo structure="positional" tag_name="END" tag_offset="0" sequence_number="5" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
                        </xs:appinfo>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:annotation>
                                <xs:appinfo>
                                    <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                            <xs:element name="END" type="xs:string">
                                <xs:annotation>
                                    <xs:appinfo>
                                        <b:fieldInfo justification="left" pos_offset="0" pos_length="63" sequence_number="1" />
                                    </xs:appinfo>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

带有测试文件:

FDR06281339CREDIT REFUND CHECKS AC 
HDR9008100000000000100006428 
DET900810000000636992103500048763699210350004876369921035000487STMT, TEST 5 01TEST 5 STMT 6902 PINE ST OMAHA NE68106-2855 0000000000+0000000000500000 00FINUT A +00000000000004900 FHSC999999 +0000000000500 EN 0099000000000 +0000000000000+000000000000000000+0000000000000+000000000000000000+0000000000000+0000000000000000000000000000+00009999999999999+00009999999999999+00000000000000000+00000000000000000+999999999999999+99999999999999900000000000+9999999999999990000000000000009900 
ADDF 6902 PINE ST OMAHA NE 68106-2855USA 
DET900810000000636992103500048763699210350004876369921035000487STMT, TEST 5 01TEST 5 STMT 6902 PINE ST OMAHA NE68106-2855 0000000000+0000000000500000 00FINUT A +00000000000004900 FHSC999999 +0000000000500 EN 0099000000000 +0000000000000+000000000000000000+0000000000000+000000000000000000+0000000000000+0000000000000000000000000000+00009999999999999+00009999999999999+00000000000000000+00000000000000000+999999999999999+99999999999999900000000000+9999999999999990000000000000009900 
ADDF 6902 PINE ST OMAHA NE 68106-2855USA 
TRL90081000000000001000000020000000000000642800000000000004900000000000000000000 
END000000100000000200000000000000000000004900000000000000000000

并输出:

  <Root xmlns="http://FlatFileSchema4">
        <FDR xmlns="">
            <FDR>FDR06281339CREDIT REFUND CHECKS AC</FDR>
        </FDR>
        <HDR xmlns="">
            <HDR>HDR9008100000000000100006428</HDR>
        </HDR>
        <RR xmlns="">
            <DET>
                <DET>DET900810000000636992103500048763699210350004876369921035000487STMT, TEST 5 01TEST 5 STMT 6902 PINE ST OMAHA NE68106-2855 0000000000+0000000000500000 00FINUT A +00000000000004900 FHSC999999 +0000000000500 EN 0099000000000 +0000000000000+000000000000000000+0000000000000+000000000000000000+0000000000000+0000000000000000000000000000+00009999999999999+00009999999999999+00000000000000000+00000000000000000+999999999999999+99999999999999900000000000+9999999999999990000000000000009900</DET>
            </DET>
            <ADD>
                <ADD>ADDF 6902 PINE ST OMAHA NE 68106-2855USA</ADD>
            </ADD>
        </RR>
        <RR xmlns="">
            <DET>
                <DET>DET900810000000636992103500048763699210350004876369921035000487STMT, TEST 5 01TEST 5 STMT 6902 PINE ST OMAHA NE68106-2855 0000000000+0000000000500000 00FINUT A +00000000000004900 FHSC999999 +0000000000500 EN 0099000000000 +0000000000000+000000000000000000+0000000000000+000000000000000000+0000000000000+0000000000000000000000000000+00009999999999999+00009999999999999+00000000000000000+00000000000000000+999999999999999+99999999999999900000000000+9999999999999990000000000000009900</DET>
            </DET>
            <ADD>
                <ADD>ADDF 6902 PINE ST OMAHA NE 68106-2855USA</ADD>
            </ADD>
        </RR>
        <TRL xmlns="">
            <TRL>TRL90081000000000001000000020000000000000642800000000000004900000000000000000000</TRL>
        </TRL>
        <END xmlns="">
            <END>END000000100000000200000000000000000000004900000000000000000000</END>
        </END>
    </Root>

我已经更新了架构,使其还包含您的测试文件现在具有的额外记录.它对我有用.

I have updated the schema to also include the extra records that your testfile now have. And it works for me.