Biztalk 如何指定平面文件模式来处理不同线型的随机序列?

Biztalk 如何指定平面文件模式来处理不同线型的随机序列?,biztalk,Biztalk,我有两种平面文件行 以@开头,例如@111 222 333 以#开头,例如#777888999 我们可以使用标记标识符来标识这两种类型的行。不幸的是,这两行可能以任何顺序出现在文件中,如@###,或@#,或##等 如果使用平面文件分解器模式,看起来序列必须是有序的,比如说@@@@code>,@@@code>,它可以将所有平面文件内容分解为XML格式 但是,如果文件格式为@@@code>或@@@code>,则无法分解所有文件内容,并将停在中间,比如说@@@code>只能分解,@@@code>只能分

我有两种平面文件行

  • @
    开头,例如
    @111 222 333

  • #
    开头,例如
    #777888999

  • 我们可以使用标记标识符来标识这两种类型的行。不幸的是,这两行可能以任何顺序出现在文件中,如
    @###
    ,或
    @#
    ,或
    ##

    如果使用平面文件分解器模式,看起来序列必须是有序的,比如说
    @@@@code>
    @@@code>,它可以将所有平面文件内容分解为XML格式

    但是,如果文件格式为
    @@@code>或
    @@@code>
    ,则无法分解所有文件内容,并将停在中间,比如说
    @@@code>只能分解
    @@@code>只能分解

    我认为这是因为平面文件模式指定的顺序是
    @
    然后是
    ,因此,
    @
    不能出现在
    之后(如果我的理解有误,请告知)

    我们的案子有什么解决办法吗


    谢谢。

    将标记的记录放在可多次出现的选项组下。 见下面的例子

    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema xmlns="http://Scratch.FlatFileSchemaRandomTagOrder" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.FlatFileSchemaRandomTagOrder" 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="postfix" 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:choice minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:appinfo>
                  <b:groupInfo sequence_number="1" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="RecordHash">
                <xs:annotation>
                  <xs:appinfo>
                    <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" tag_name="#" child_order="infix" child_delimiter_type="char" child_delimiter=" " />
                  </xs:appinfo>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:annotation>
                      <xs:appinfo>
                        <b:groupInfo sequence_number="0" />
                      </xs:appinfo>
                    </xs:annotation>
                    <xs:element name="Field1" type="xs:string">
                      <xs:annotation>
                        <xs:appinfo>
                          <b:fieldInfo sequence_number="1" justification="left" />
                        </xs:appinfo>
                      </xs:annotation>
                    </xs:element>
                    <xs:element name="Field2" type="xs:string">
                      <xs:annotation>
                        <xs:appinfo>
                          <b:fieldInfo justification="left" sequence_number="2" />
                        </xs:appinfo>
                      </xs:annotation>
                    </xs:element>
                    <xs:element name="Field3" type="xs:string">
                      <xs:annotation>
                        <xs:appinfo>
                          <b:fieldInfo justification="left" sequence_number="3" />
                        </xs:appinfo>
                      </xs:annotation>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="RecordAt">
                <xs:annotation>
                  <xs:appinfo>
                    <b:recordInfo sequence_number="2" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="@" child_order="infix" child_delimiter_type="char" child_delimiter=" " />
                  </xs:appinfo>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:annotation>
                      <xs:appinfo>
                        <b:groupInfo sequence_number="0" />
                      </xs:appinfo>
                    </xs:annotation>
                    <xs:element name="Field1" type="xs:string">
                      <xs:annotation>
                        <xs:appinfo>
                          <b:fieldInfo sequence_number="1" justification="left" />
                        </xs:appinfo>
                      </xs:annotation>
                    </xs:element>
                    <xs:element name="Field2" type="xs:string">
                      <xs:annotation>
                        <xs:appinfo>
                          <b:fieldInfo justification="left" sequence_number="2" />
                        </xs:appinfo>
                      </xs:annotation>
                    </xs:element>
                    <xs:element name="Field3" type="xs:string">
                      <xs:annotation>
                        <xs:appinfo>
                          <b:fieldInfo justification="left" sequence_number="3" />
                        </xs:appinfo>
                      </xs:annotation>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    
    输出

    <Root xmlns="http://Scratch.FlatFileSchemaRandomTagOrder">
      <RecordAt xmlns="">
        <Field1>111</Field1>
        <Field2>222</Field2>
        <Field3>333</Field3>
      </RecordAt>
      <RecordHash xmlns="">
        <Field1>777</Field1>
        <Field2>888</Field2>
        <Field3>999</Field3>
      </RecordHash>
      <RecordAt xmlns="">
        <Field1>111</Field1>
        <Field2>222</Field2>
        <Field3>333</Field3>
      </RecordAt>
    </Root>
    
    
    111
    222
    333
    777
    888
    999
    111
    222
    333
    
    <Root xmlns="http://Scratch.FlatFileSchemaRandomTagOrder">
      <RecordAt xmlns="">
        <Field1>111</Field1>
        <Field2>222</Field2>
        <Field3>333</Field3>
      </RecordAt>
      <RecordHash xmlns="">
        <Field1>777</Field1>
        <Field2>888</Field2>
        <Field3>999</Field3>
      </RecordHash>
      <RecordAt xmlns="">
        <Field1>111</Field1>
        <Field2>222</Field2>
        <Field3>333</Field3>
      </RecordAt>
    </Root>