Search code examples
biztalkflat-file

BTS flat file schema generate with unbounded max records inside


I have a problem with generate/create schema for input document as flatfile in Visual studio with BTS Dev tools.

please look at the example:

enter image description here

[User Story]

as you can see schema is a CSV formated flat file.

Marked on green is a customer lvl (segment) and can exist couple times in input file (unbounded). Inside of this customer segment we will find CUST and CUST_INF records, thous records can exist in first case min : 1, max: 1 and in second case min: 0, max: 1.

Marked on red is a invoice lvl (segment) and can exist couple times in input file (unbounded). Inside of this segment we will find INV (min: 1, max: 1) and INV_INFO (min: 0, max: 1) and INV_LIN (min: 1 max: unbounded).

[QUESTION]

How to create valid schema for this case ?

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;

I've removed LIN_INF record (I mean empty line too) from input doc in second INV segment (this record is optional), at this moment validation will stop at the end of line of second segment "INV;field_1;field_2;field_3;".

[UPDATE 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>

EXAMPLE 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   

Solution

    1. Use the Flat File Wizard. Add, New Item, Flat File Schema Wizard, give the schema a name and click Add. Click next

    2. Select the Instance File (example message) and click Next

    3. On the record being defined: /Root just leave things as they are and click Next.

    4. Format, leave as By delimiter symbol and click Next

    5. Child delimiter: {CR}{LF} is correct so click Next.

    6. Change the Element Name and the Element Type to Record, Repeating Record or Ignore (Note: I'm Ignoring all but the first instance of each type, see below, and I've marked CUST_INF as a repeating one so I can ignore the following lines). click Next.

    enter image description here

    Then it wants you to define each record. You will have to repeat the following steps for each record

    1. Click Next, Next, Next, set Child delimiter to ;

    2. Click Record has a tag identifier and enter the tag for that record e.g. INFO; click Next (Note: I'm including the ; in the tag, otherwise it treats it as prefix delimited rather than a postfix delimited record and you end up with an empty field at the end of each record).

    3. Set the Element Name and types, click Next

    Repeat above steps until you have done all the records and click Finish.

    Now you will have a base schema that will look like below. However that will not validate yet as we have to define some of the repeating groups following the steps below.

    enter image description here

    1. Right click the Root node and Add a Sequence Group, set the Max Occurs to unbounded by entering a *

    2. Cut and past the CUST & CUST_INF nodes into the sequence node

    3. Update the CUST_INF to have a Min Occurs 0 and Max Occurs 1 (the 1 is optional as the default is 1)

    4. Right click the Root node and Add a Sequence Group, set the Max Occurs to unbounded by entering a *

    5. Cut and past the INV, INV_INF & INV_LIN into the second sequence group

    6. Set the INV_INF to Min Occurs 0 and Max Occurs 1 (the 1 is optional as the default is 1)

    Your schema should now look like this and be able to parse your flat file.

    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>
    

    [UPDATE 15-11-2016]

    If you have a blank like like that, just add a Choice Node put the INV_INF below it and add another record with no Tag and one field below it so it looks like below. If CUST_INF can also be replaced by a blank, then do the same for that node.

    enter image description here