【问题标题】:BizTalk FlatFile Schema multiple repeating recordsBizTalk FlatFile 架构多个重复记录
【发布时间】:2013-07-30 16:19:03
【问题描述】:

我有一个平面文件,我需要创建一个架构,以便我可以将该平面文件转换为 XML 并将其带到 BizTalk。

我已使用平面文件架构向导创建架构,但它无法正常工作。我手动修改过还是不行。我会解释什么是行不通的。

Flat File structure:
File header
Batch header
Detail (repeating records)
Address (repeating records)
Trailer
END

创建架构后,我正在尝试对其进行验证,但此时我遇到了错误。 Detail 和 Address 是主体,它们是可重复的。 我的问题是,在它读取“DET”行之后,它应该读取“ADD”。但是它又在寻找“DET”。

错误描述: 错误 BEC2004:查找时发现意外数据: 'DET' 当前正在解析的定义是 RefundsRoot。发生错误的流偏移量为799。发生错误的行号为4。发生错误的列为0。

这里是示例

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
TRL90081000000000001000000020000000000000642800000000000004900000000000000000000
END000000100000000200000000000000000000004900000000000000000000

这是架构(由于字符限制,我只包含相关部分)

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Fingerhut.BizTalk.Schemas.FSIn_Refunds" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Fingerhut.BizTalk.Schemas.FSIn_Refunds" 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="0x0A 0x0D" pad_char_type="hex" count_positions_by_byte="false" parser_optimization="speed" 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="true" compile_parse_tables="false" root_reference="RefundsRoot" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="RefundsRoot">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" />
      </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:complexType name="Detail">
    <xs:sequence>
      <xs:annotation>
        <xs:appinfo>
          <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
        </xs:appinfo>
      </xs:annotation>
      <xs:element name="DETL-HDR" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="3" sequence_number="1" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-SYSTEM" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="4" sequence_number="2" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-PRIN-BANK" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="4" sequence_number="3" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-AGENT-BANK" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="4" sequence_number="4" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-ACCOUNT-NUMBER" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="16" sequence_number="5" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-PRMR-PI-ID" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="16" sequence_number="6" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-ENTR-ID" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="16" sequence_number="7" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-PI-NM" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="8" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-FILLER" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="2" sequence_number="9" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-PI-ROLE-CD" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="2" sequence_number="10" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-PRIMARY-NAME" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="11" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-SECONDARY-NAME" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="12" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-ADDRESS-LINE-1" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="13" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-ADDRESS-LINE-2" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="14" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-CITY" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="18" sequence_number="15" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-STATE" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="2" sequence_number="16" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-POST-CODE" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="17" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-REF-NUM" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="18" sequence_number="18" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-CHK-STARTING-NUM" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="5" sequence_number="19" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-NUMBER-OF-CKS" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="4" sequence_number="20" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-DUALITY-FLAG" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="1" sequence_number="21" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-CREDIT-LIMIT" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="14" sequence_number="22" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-NUMBER-OF-PLASTICS" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="3" sequence_number="23" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="DETL-CHECKING-ACCOUNT-NUM" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="17" sequence_number="24" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Address">
    <xs:sequence>
      <xs:annotation>
        <xs:appinfo>
          <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
        </xs:appinfo>
      </xs:annotation>
      <xs:element name="ADDR-EXPN-ADDR-RCRD-HEDR-ID" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="3" sequence_number="1" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-PRMR-CUST-ADDR-FRMT-CD" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="1" sequence_number="2" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-ATTN-LINE-TX" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="3" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-CMPN-NM" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="4" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-HOUS-NR" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="5" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-STRT-NM" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="40" sequence_number="6" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-CNTN-ADDR-LINE-1-TX" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="7" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-CNTN-ADDR-LINE-2-TX" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="8" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-CNTN-ADDR-LINE-3-TX" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="9" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-CNTN-ADDR-LINE-4-TX" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="10" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-PO-BOX-TX" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="11" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-CITY-NM" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="25" sequence_number="12" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-ST-CD" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="2" sequence_number="13" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-SBDV-TX" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="25" sequence_number="14" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-PSTL-CD" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="15" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-CTRY-CD" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification="left" pos_offset="0" pos_length="3" sequence_number="16" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ADDR-FILLER" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo sequence_number="17" justification="left" pos_length="271" pos_offset="0" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

【问题讨论】:

    标签: schema biztalk flat-file


    【解决方案1】:

    以下架构有效(您当然需要将我的字符串元素更改为正确的位置记录)。

    你要做的是:

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

    这为您提供了以下架构:

    <?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>
    

    我已经更新了架构以包含您的测试文件现在拥有的额外记录。它对我有用。

    【讨论】:

    • 由于字符限制,我无法添加多个。我可以把它放在这里,你可以把它添加到上面的文件中。 DET900810000000636992100000616263699210000061626369921000006162THOMPSON,ICILDA 01ICILDA THOMPSON 2122 WARREN ST EVANSTON IL60202-1954 0000000000 + 0000000000900000 00FINUT甲000000000000029.10 02000 F249999999 0000000000900 029EN 024.90000.00000 + 00000000000.00 + 00099999999999900.0000.00000.00024.900 跨度>
    • 这是第二行。您可以多次复制和重复它们。 ADDF 2122 WARREN ST EVANSTON IL 60202-1954USA
    • 1- 是的,它是位置文件,每行末尾都有换行符 (CRLF)。 2- 由于字符限制,我省略了一些数据,这就是为什么它看起来不一样。 3-它们总是有序的(DET ADD,DET ADD,DET ADD)意味着每个DET都应该有ADD。这有意义吗。问题是当它读取第 4 行时,它期望标签标识符 DET 而不是 ADD。这是它失败的地方,我不知道如何解决这个问题。
    • 我试过了,但我得到了不同的错误。默认填充字符和默认子分隔符设置为 0x0D 0x0A 但我仍然收到此错误 BEC2004: Unexpected end of stream whilelooking: '\r\n' 当前正在解析的定义是 DET。发生错误的流偏移量为1379。发生错误的行号为8。发生错误的列为0。
    • 忘记提及“允许提前终止”设置为 True。
    猜你喜欢
    • 1970-01-01
    • 2015-12-11
    • 1970-01-01
    • 2021-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多