Visual studio biztalk中平面文件中的可选行

Visual studio biztalk中平面文件中的可选行,visual-studio,biztalk,flat-file,Visual Studio,Biztalk,Flat File,我必须使用Biztalk将需要转换为UBL的文件格式化 一切都很好,直到我到达平面文件的末尾 其中一个看起来像这样 RZ0100120400R;RZ01-00120400;RAZER MAMBA 2012 EL;2;739,77;2013.06.12 RZ0100580100R;RZ01-00580100;RAZER NAGA 2012;1;482,38;2013.06.12 RZ0400590100R;RZ04-00590100;RAZER TIAMAT EXPERT;2;605,3;2013

我必须使用Biztalk将需要转换为UBL的文件格式化

一切都很好,直到我到达平面文件的末尾

其中一个看起来像这样

RZ0100120400R;RZ01-00120400;RAZER MAMBA 2012 EL;2;739,77;2013.06.12
RZ0100580100R;RZ01-00580100;RAZER NAGA 2012;1;482,38;2013.06.12
RZ0400590100R;RZ04-00590100;RAZER TIAMAT EXPERT;2;605,3;2013.06.12

TOTA;L FAKTURAVÆRDI;EKSKL. MOMS;;18.667,30;
另一个是这样的:

382908;382908;Anymode Samsung Gal;4;88,87;2013.06.13
382909;382909;Anymode Samsung Gal;4;88,87;2013.06.13
ANYMODESAMSUN;ANYMODE SAMSU;ANYMODE ANYMODE SAM;4;88,87;2013.06.13
;;;;;
TOTA;L FAKTURAVÆRDI;EKSKL. MOMS;;8.116,31;
如果我为其中一个创建一个模式,那么另一个模式将无法工作。所以我的问题是。 如何创建一个可以同时使用这两种模式的模式,而不会出现问题?? 我只需要对第一个示例中的空行进行调整。
我正在使用Visual Studio平面文件向导。

您可以将有问题的记录/行及其所有子字段元素设置为可选(Min-Occurs=0)

示例模式(使用提供的两个示例平面文件进行测试…):


希望有帮助

致以最诚挚的问候
菲利普

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://SampleProject.FlatFileSchema1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://SampleProject.FlatFileSchema1" 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="infix" 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 minOccurs="0" maxOccurs="unbounded" name="line">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="infix" 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 minOccurs="0" name="Child1" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="1" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element minOccurs="0" name="Child2" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="2" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element minOccurs="0" name="Child3" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="3" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element minOccurs="0" name="Child4" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="4" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element minOccurs="0" name="Child5" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="5" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element minOccurs="0" name="Child6" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="6" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>