2016-11-14 26 views
1

我有一個問題,生成/創建架構輸入文件作爲平面文件在Visual Studio與BTS開發工具。BTS平面文件架構生成與無限最大記錄裏面

請看例子:

enter image description here

[用戶故事]

正如你所看到的架構是一個CSV格式化平面文件

標記爲綠色是客戶lvl(段),可以在輸入文件中存在幾次(無界)。這裏面客戶羣,我們會發現CUSTCUST_INF記錄,古都記錄可以第一情況下存在分:1最大:1第二情況下分:0max:1

標記爲紅色是發票lvl(段),可以在輸入文件(無界)中存在幾次。在這個段的內部,我們會發現INV(min:1,max:1)和INV_INFO(min:0,max:1)和INV_LIN(min:1 max:unbounded)。

[問題]

如何創建有效架構針對這種情況?

INFO;field_1;field_2;field_3; 
CUST;field_1;field_2;field_3; 
CUST_INF;field_1;field_2;field_3; 
CUST;field_1;field_2;field_3; 
CUST_INF;field_1;field_2;field_3; 
INV;field_1;field_2;field_3; 
INV_INF;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV;field_1;field_2;field_3; 
INV_INF;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 

[UPDATE 15-11-2016]

INFO;field_1;field_2;field_3; 
CUST;field_1;field_2;field_3; 
CUST_INF;field_1;field_2;field_3; 
CUST;field_1;field_2;field_3; 
CUST_INF;field_1;field_2;field_3; 
INV;field_1;field_2;field_3; 
INV_INF;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV;field_1;field_2;field_3; <-- validation stop 

INV_LIN;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 

我已經刪除LIN_INF記錄(我的意思是空的線也行),從輸入文檔中第二INV段(該記錄是可選),此時驗證停止在第二段「INV; field_1; field_2; field_3;」的行的末尾。

[更新16.11。2016]

SCHEMA

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns="http://Test.FlatFileSchema1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Test.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 name="INFO"> 
      <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo tag_name="INFO;" structure="delimited" child_delimiter_type="char" child_delimiter=";" 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="Root_Child1_Child1" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="1" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child1_Child2" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="2" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child1_Child3" 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:sequence minOccurs="1" maxOccurs="unbounded"> 
      <xs:annotation> 
      <xs:appinfo> 
       <groupInfo sequence_number="2" xmlns="http://schemas.microsoft.com/BizTalk/2003" /> 
      </xs:appinfo> 
      </xs:annotation> 
      <xs:element minOccurs="1" maxOccurs="1" name="CUST"> 
      <xs:annotation> 
       <xs:appinfo> 
       <b:recordInfo tag_name="CUST;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" 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="Root_Child2_Child1" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="1" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child2_Child2" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="2" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child2_Child3" 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 minOccurs="0" maxOccurs="1" name="CUST_INF"> 
      <xs:annotation> 
       <xs:appinfo> 
       <b:recordInfo tag_name="CUST_INF;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" 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="Root_Child3_Child1" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="1" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child3_Child2" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="2" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child3_Child3" 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:sequence> 
     <xs:sequence minOccurs="0" maxOccurs="unbounded"> 
      <xs:annotation> 
      <xs:appinfo> 
       <groupInfo sequence_number="3" xmlns="http://schemas.microsoft.com/BizTalk/2003" /> 
      </xs:appinfo> 
      </xs:annotation> 
      <xs:element minOccurs="1" maxOccurs="1" name="INV"> 
      <xs:annotation> 
       <xs:appinfo> 
       <b:recordInfo tag_name="INV;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" 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="Root_Child6_Child1" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="1" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child6_Child2" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="2" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child6_Child3" 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 minOccurs="0" maxOccurs="1" name="INV_INF"> 
      <xs:annotation> 
       <xs:appinfo> 
       <b:recordInfo tag_name="INV_INF;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" 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="Root_Child7_Child1" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="1" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child7_Child2" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="2" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child7_Child3" 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 minOccurs="0" maxOccurs="unbounded" name="INV_LIN"> 
      <xs:annotation> 
       <xs:appinfo> 
       <b:recordInfo tag_name="INV_LIN;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="3" /> 
       </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="Root_Child8_Child1" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="1" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child8_Child2" type="xs:string"> 
        <xs:annotation> 
        <xs:appinfo> 
         <b:fieldInfo justification="left" sequence_number="2" /> 
        </xs:appinfo> 
        </xs:annotation> 
       </xs:element> 
       <xs:element name="Root_Child8_Child3" 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:sequence> 
     </xs:sequence> 
    </xs:complexType> 
    </xs:element> 
</xs:schema> 

例DATA

INFO;field_1;field_2;field_3; 
CUST;field_1;field_2;field_3; 
CUST_INF;field_1;field_2;field_3; 
CUST;field_1;field_2;field_3; 
CUST_INF;field_1;field_2;field_3; 
INV;field_1;field_2;field_3; 
INV_INF;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 
INV_LIN;field_1;field_2;field_3; 

ERRORS

Error 1 Unexpected data found while looking for: 
'INV_INF;' 
'INV;' 
The current definition being parsed is Root. The stream offset where the error occured is 359. The line number where the error occured is 12. The column where the error occured is 0. C:\Users\Administrator\Desktop\test.txt 1 1 
+1

能否請您給在包含多個客戶,發票,所以我們可以看到它們是如何發生多次文本(而不是圖形)的樣本? – Dijkgraaf

+1

您的最後一行在最後一行之後是否有CR LF?如果是這樣,您需要將您的根節點從Child Order Infix更改爲Postfix。 – Dijkgraaf

+0

@Dijkgraaf是的,你有權利,我有中綴,thx。 – Nerus

回答

1
  1. 使用平面文件嚮導。添加新項目,平面文件架構嚮導,給架構一個名稱,然後單擊添加。點擊下一步

  2. 選擇實例文件(例如消息),然後單擊下一步

  3. 在記錄被定義:/根剛剛離開的事情,因爲它們並單擊下一步。

  4. 格式,留下由定界符,然後單擊下一步

  5. 兒童分隔符:{CR} {LF}是正確的那麼單擊下一步。 (注意:我忽略了除每個類型的第一個實例之外的所有內容,請參見下文,並且我已將CUST_INF標記爲重複的一個,所以如下所示)我可以忽略以下幾行)。點擊下一步。

enter image description here

然後它要你來定義每個記錄。您必須爲每條記錄重複以下步驟

  1. 單擊Next,Next,Next,將Child delimiter設置爲;

  2. 點擊記錄具有標籤標識符並輸入該記錄的標籤,例如,信息;點擊下一步(注意:我在標籤中包含;否則將它視爲前綴分隔符而不是後綴分隔符記錄,最後每個記錄末尾會有一個空字段)。

  3. 設置元素的名稱和類型,然後單擊下一步

重複以上步驟,直到你做了所有的記錄,然後單擊Finish。

現在您將擁有一個如下所示的基本模式。但是,這還不能驗證,因爲我們必須按照以下步驟定義一些重複組。

enter image description here

  • 右擊根節點和添加的序列組,設置Max通過輸入*

  • 剪切和過去的CUST發生於無界& CUST_INF節點到序列節點

  • 更新CUST_INF具有最小發生0和最大時發生1(1是可選的,因爲默認值爲1)

  • 右鍵單擊根節點,並添加一個序列組,設置Max通過輸入*

  • 剪切和過去的INV,INV_INF & INV_LIN進入第二序列組

  • 將發生於無界限INV_INF閔發生0和Max發生1(1是可選的,因爲默認爲1)

  • 你現在的模式應該是這樣的,並能夠分析您的平面文件。

    enter image description here

    <?xml version="1.0" encoding="utf-16"?> 
    <xs:schema xmlns="http://Scratch.FlatFileSchema40595371w" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.FlatFileSchema40595371w" 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="INFO"> 
          <xs:annotation> 
          <xs:appinfo> 
           <b:recordInfo tag_name="INFO;" structure="delimited" child_delimiter_type="char" child_delimiter=";" 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="INFO_Child1" type="xs:string"> 
           <xs:annotation> 
            <xs:appinfo> 
            <b:fieldInfo justification="left" sequence_number="1" /> 
            </xs:appinfo> 
           </xs:annotation> 
           </xs:element> 
           <xs:element name="INFO_Child2" type="xs:string"> 
           <xs:annotation> 
            <xs:appinfo> 
            <b:fieldInfo justification="left" sequence_number="2" /> 
            </xs:appinfo> 
           </xs:annotation> 
           </xs:element> 
           <xs:element name="INFO_Child3" 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:sequence maxOccurs="unbounded"> 
          <xs:annotation> 
          <xs:appinfo> 
           <groupInfo sequence_number="2" xmlns="http://schemas.microsoft.com/BizTalk/2003" /> 
          </xs:appinfo> 
          </xs:annotation> 
          <xs:element name="CUST"> 
          <xs:annotation> 
           <xs:appinfo> 
           <b:recordInfo tag_name="CUST;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" 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="CUST_Child1" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="1" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="CUST_Child2" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="2" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="CUST_Child3" 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 minOccurs="0" maxOccurs="1" name="CUST_INF"> 
          <xs:annotation> 
           <xs:appinfo> 
           <b:recordInfo tag_name="CUST_INF;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" 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="CUST_INF_Child1" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="1" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="CUST_INF_Child2" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="2" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="CUST_INF_Child3" 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:sequence> 
         <xs:sequence> 
          <xs:annotation> 
          <xs:appinfo> 
           <groupInfo sequence_number="3" xmlns="http://schemas.microsoft.com/BizTalk/2003" /> 
          </xs:appinfo> 
          </xs:annotation> 
          <xs:element name="INV"> 
          <xs:annotation> 
           <xs:appinfo> 
           <b:recordInfo tag_name="INV;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" 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="INV_Child1" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="1" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="INV_Child2" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="2" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="INV_Child3" 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 minOccurs="0" name="INV_INF"> 
          <xs:annotation> 
           <xs:appinfo> 
           <b:recordInfo tag_name="INV_INF;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" 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="INV_INF_Child1" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="1" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="INV_INF_Child2" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="2" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="INV_INF_Child3" 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 maxOccurs="unbounded" name="INV_LIN"> 
          <xs:annotation> 
           <xs:appinfo> 
           <b:recordInfo tag_name="INV_LIN;" structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="postfix" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="3" /> 
           </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="INV_LIN_Child1" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="1" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="INV_LIN_Child2" type="xs:string"> 
            <xs:annotation> 
            <xs:appinfo> 
             <b:fieldInfo justification="left" sequence_number="2" /> 
            </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
           <xs:element name="INV_LIN_Child3" 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:sequence> 
         </xs:sequence> 
        </xs:complexType> 
        </xs:element> 
    </xs:schema> 
    

    [更新15-11-2016]

    如果你有一個空白像這樣,只需添加一個選擇節點把INV_INF下方,並添加另一條記錄,沒有標籤和下面的一個字段,所以它看起來像下面。如果CUST_INF也可以替換爲空白,那麼對該節點執行相同的操作。

    enter image description here

    +0

    我有一個問題,當文檔在輸出驗證我有XML輸出文檔,基本上它的確定,但驗證停止(正面)不在輸入文檔的記錄,例如:INV_INFO是可選的,這個記錄網絡存在這個地方在輸入文件中,驗證會在此記錄之前停止記錄,原因是什麼?如何解決它? – Nerus

    +1

    @Nerus我不太確定你在問什麼。你可以用樣本文件,你正在使用的模式以及輸出結果與你期望的結果一起發佈一個新問題嗎? – Dijkgraaf

    +0

    主線程已更新。 – Nerus