locked
Flat file schema for multiple records - Works when there is just a single set RRS feed

  • Question

  • Hi,

    I kindly need some help with the schema I am trying to generate for a flat file. The flat file is structured something like below:

    #I|P701760|GBP|LOND|0668186410141228|14/10/2014|300.00|Auth|0668186410141228CREXP
    #D|13/10/2014|150.00|TXN|IX|SZM|For 14/10/14 Taxi Airport Trip|132|10|010006681864
    #D|13/10/2014|150.00|TXN|IX|SZM|For 14/10/14 Taxi Airport Trip|132|10|010006681864
    #I|P701760|GBP|LOND|0668373910141228|14/10/2014|650.00|Auth|0668373910141228CREXP
    #D|13/10/2014|650.00|TXN|IX|SZM|For14/10/14 Flight|264|10|010006683739

    The row with #I are supposed to be the header record and the #D rows are the child records. When I generate the schema I end up with something like this:

    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema xmlns="http://XCorp.BizTalkIntegration.PreTransform.FlatFileSchema2" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://XCorp.BizTalkIntegration.PreTransform.FlatFileSchema2" 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="complexity" 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 tag_name="#I" 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="Root_Child1">
              <xs:annotation>
                <xs:appinfo>
                  <b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="prefix" 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:element name="Root_Child1_Child4" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="4" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child1_Child5" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="5" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child1_Child6" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="6" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child1_Child7" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="7" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child1_Child8" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="8" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element maxOccurs="unbounded" name="Root_Child2">
              <xs:annotation>
                <xs:appinfo>
                  <b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="infix" 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="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:element name="Root_Child2_Child4" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="4" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child2_Child5" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="5" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child2_Child6" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="6" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child2_Child7" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="7" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child2_Child8" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="8" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child2_Child9" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="9" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                  <xs:element name="Root_Child2_Child10" type="xs:string">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="10" />
                      </xs:appinfo>
                    </xs:annotation>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

    When I do a 'Validate Instance' I end up with the xml looking like this:

    - <Root_Child1 xmlns="">
      <Root_Child1_Child1>P701760</Root_Child1_Child1>
      <Root_Child1_Child2>GBP</Root_Child1_Child2>
      <Root_Child1_Child3>LOND</Root_Child1_Child3>
      <Root_Child1_Child4>0668186410141228</Root_Child1_Child4>
      <Root_Child1_Child5>14/10/2014</Root_Child1_Child5>
      <Root_Child1_Child6>300.00</Root_Child1_Child6>
      <Root_Child1_Child7>Auth</Root_Child1_Child7>
      <Root_Child1_Child8>0668186410141228CREXP</Root_Child1_Child8>
      </Root_Child1>
    - <Root_Child2 xmlns="">
      <Root_Child2_Child1>#D</Root_Child2_Child1>
      <Root_Child2_Child2>13/10/2014</Root_Child2_Child2>
      <Root_Child2_Child3>150.00</Root_Child2_Child3>
      <Root_Child2_Child4>TXN</Root_Child2_Child4>
      <Root_Child2_Child5>IX</Root_Child2_Child5>
      <Root_Child2_Child6>SZM</Root_Child2_Child6>
      <Root_Child2_Child7>For 14/10/14 Taxi Airport Trip
    </Root_Child2_Child7>
      <Root_Child2_Child8>132</Root_Child2_Child8>
      <Root_Child2_Child9>10</Root_Child2_Child9>
      <Root_Child2_Child10>010006681864</Root_Child2_Child10>
      </Root_Child2>
    - <Root_Child2 xmlns="">
      <Root_Child2_Child1>#D</Root_Child2_Child1>
      <Root_Child2_Child2>13/10/2014</Root_Child2_Child2>
      <Root_Child2_Child3>150.00</Root_Child2_Child3>
      <Root_Child2_Child4>TXN</Root_Child2_Child4>
      <Root_Child2_Child5>IX</Root_Child2_Child5>
      <Root_Child2_Child6>SZM</Root_Child2_Child6>
      <Root_Child2_Child7>For 14/10/14 Taxi Airport Trip
    </Root_Child2_Child7>
      <Root_Child2_Child8>132</Root_Child2_Child8>
      <Root_Child2_Child9>10</Root_Child2_Child9>
      <Root_Child2_Child10>010006681864</Root_Child2_Child10>
      </Root_Child2>
    - <Root_Child2 xmlns="">
      <Root_Child2_Child1>#I</Root_Child2_Child1>
      <Root_Child2_Child2>P701760</Root_Child2_Child2>
      <Root_Child2_Child3>GBP</Root_Child2_Child3>
      <Root_Child2_Child4>LOND</Root_Child2_Child4>
      <Root_Child2_Child5>0668373910141228</Root_Child2_Child5>
      <Root_Child2_Child6>14/10/2014</Root_Child2_Child6>
      <Root_Child2_Child7>650.00</Root_Child2_Child7>
      <Root_Child2_Child8>Auth</Root_Child2_Child8>
      <Root_Child2_Child9>0668373910141228CREXP #D</Root_Child2_Child9>
      <Root_Child2_Child10>13/10/2014|650.00|A0722-09203|IX|SZM|For 14/10/14 Flight|264|10|010006683739</Root_Child2_Child10>
      </Root_Child2>
      </Root>

    It doesn't recognise the second set of  #I to be a new header record and puts it as a child record. I know I am doing something wrong. Could you kindly guide me the correct way to sort this. Many Thanks in advance.

    Tuesday, October 28, 2014 12:07 PM

Answers

  • try this:

    Schema looks like this:

    Actual Schema is:

    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema xmlns="http://testflatfile.FlatFileSchema1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://testflatfile.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 maxOccurs="unbounded" name="RepeatingChildern">
              <xs:annotation>
                <xs:appinfo>
                  <recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" 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 maxOccurs="1" name="Root_Child1">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:recordInfo tag_name="#I" structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="prefix" 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_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:element name="Root_Child1_Child4" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="4" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child1_Child5" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="5" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child1_Child6" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="6" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child1_Child7" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="7" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child1_Child8" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="8" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                  <xs:element maxOccurs="unbounded" name="Root_Child2">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:recordInfo tag_name="#D" structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="prefix" 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_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:element name="Root_Child2_Child4" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="4" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child5" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="5" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child6" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="6" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child7" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="7" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child8" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="8" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child9" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="9" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

    My output looks like this:

    <Root xmlns="http://testflatfile.FlatFileSchema1"><RepeatingChildern xmlns=""><Root_Child1><Root_Child1_Child1>P701760</Root_Child1_Child1><Root_Child1_Child2>GBP</Root_Child1_Child2><Root_Child1_Child3>LOND</Root_Child1_Child3><Root_Child1_Child4>0668186410141228</Root_Child1_Child4><Root_Child1_Child5>14/10/2014</Root_Child1_Child5><Root_Child1_Child6>300.00</Root_Child1_Child6><Root_Child1_Child7>Auth</Root_Child1_Child7><Root_Child1_Child8>0668186410141228CREXP</Root_Child1_Child8></Root_Child1><Root_Child2><Root_Child2_Child1>13/10/2014</Root_Child2_Child1><Root_Child2_Child2>150.00</Root_Child2_Child2><Root_Child2_Child3>TXN</Root_Child2_Child3><Root_Child2_Child4>IX</Root_Child2_Child4><Root_Child2_Child5>SZM</Root_Child2_Child5><Root_Child2_Child6>For 14/10/14 Taxi Airport Trip</Root_Child2_Child6><Root_Child2_Child7>132</Root_Child2_Child7><Root_Child2_Child8>10</Root_Child2_Child8><Root_Child2_Child9>010006681864</Root_Child2_Child9></Root_Child2><Root_Child2><Root_Child2_Child1>13/10/2014</Root_Child2_Child1><Root_Child2_Child2>150.00</Root_Child2_Child2><Root_Child2_Child3>TXN</Root_Child2_Child3><Root_Child2_Child4>IX</Root_Child2_Child4><Root_Child2_Child5>SZM</Root_Child2_Child5><Root_Child2_Child6>For 14/10/14 Taxi Airport Trip</Root_Child2_Child6><Root_Child2_Child7>132</Root_Child2_Child7><Root_Child2_Child8>10</Root_Child2_Child8><Root_Child2_Child9>010006681864</Root_Child2_Child9></Root_Child2></RepeatingChildern><RepeatingChildern xmlns=""><Root_Child1><Root_Child1_Child1>P701760</Root_Child1_Child1><Root_Child1_Child2>GBP</Root_Child1_Child2><Root_Child1_Child3>LOND</Root_Child1_Child3><Root_Child1_Child4>0668373910141228</Root_Child1_Child4><Root_Child1_Child5>14/10/2014</Root_Child1_Child5><Root_Child1_Child6>650.00</Root_Child1_Child6><Root_Child1_Child7>Auth</Root_Child1_Child7><Root_Child1_Child8>0668373910141228CREXP</Root_Child1_Child8></Root_Child1><Root_Child2><Root_Child2_Child1>13/10/2014</Root_Child2_Child1><Root_Child2_Child2>650.00</Root_Child2_Child2><Root_Child2_Child3>TXN</Root_Child2_Child3><Root_Child2_Child4>IX</Root_Child2_Child4><Root_Child2_Child5>SZM</Root_Child2_Child5><Root_Child2_Child6>For14/10/14 Flight</Root_Child2_Child6><Root_Child2_Child7>264</Root_Child2_Child7><Root_Child2_Child8>10</Root_Child2_Child8><Root_Child2_Child9>010006683739</Root_Child2_Child9></Root_Child2></RepeatingChildern></Root>


    Bill Chesnut | BizTalk Server MVP | Mexia Consulting | Melbourne Australia
    http://www.biztalkbill.com | http://www.mexia.com.au
    Please indicate "Mark as Answer" if this post has answered the question.

    • Marked as answer by shivkat Wednesday, October 29, 2014 11:29 AM
    Wednesday, October 29, 2014 9:36 AM

All replies

  • I kindly need some help with the schema I am trying to generate for a flat file. The flat file is structured something like below:

    #I|P701760|GBP|LOND|0668186410141228|14/10/2014|300.00|Auth|0668186410141228CREXP
    #D|13/10/2014|150.00|TXN|IX|SZM|For 14/10/14 Taxi Airport Trip|132|10|010006681864
    #D|13/10/2014|150.00|TXN|IX|SZM|For 14/10/14 Taxi Airport Trip|132|10|010006681864
    #I|P701760|GBP|LOND|0668373910141228|14/10/2014|650.00|Auth|0668373910141228CREXP
    #D|13/10/2014|650.00|TXN|IX|SZM|For14/10/14 Flight|264|10|010006683739

    The row with #I are supposed to be the header record and the #D rows are the child records. When I generate the schema I end up with something like this:

    Hi shivkat,

    The BizTalk Flat File Schema Wizard is designed to simplify the process of creating flat file schemas, here is the article about creating Schemas using BizTalk Flat File Schema Wizard, please check whether it is available for you on this issue.

    Please let me know if there is anything that I can do to help.

    Best regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 29, 2014 9:17 AM
  • try this:

    Schema looks like this:

    Actual Schema is:

    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema xmlns="http://testflatfile.FlatFileSchema1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://testflatfile.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 maxOccurs="unbounded" name="RepeatingChildern">
              <xs:annotation>
                <xs:appinfo>
                  <recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" 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 maxOccurs="1" name="Root_Child1">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:recordInfo tag_name="#I" structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="prefix" 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_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:element name="Root_Child1_Child4" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="4" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child1_Child5" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="5" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child1_Child6" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="6" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child1_Child7" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="7" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child1_Child8" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="8" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                  <xs:element maxOccurs="unbounded" name="Root_Child2">
                    <xs:annotation>
                      <xs:appinfo>
                        <b:recordInfo tag_name="#D" structure="delimited" child_delimiter_type="char" child_delimiter="|" child_order="prefix" 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_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:element name="Root_Child2_Child4" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="4" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child5" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="5" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child6" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="6" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child7" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="7" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child8" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="8" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                        <xs:element name="Root_Child2_Child9" type="xs:string">
                          <xs:annotation>
                            <xs:appinfo>
                              <b:fieldInfo justification="left" sequence_number="9" />
                            </xs:appinfo>
                          </xs:annotation>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

    My output looks like this:

    <Root xmlns="http://testflatfile.FlatFileSchema1"><RepeatingChildern xmlns=""><Root_Child1><Root_Child1_Child1>P701760</Root_Child1_Child1><Root_Child1_Child2>GBP</Root_Child1_Child2><Root_Child1_Child3>LOND</Root_Child1_Child3><Root_Child1_Child4>0668186410141228</Root_Child1_Child4><Root_Child1_Child5>14/10/2014</Root_Child1_Child5><Root_Child1_Child6>300.00</Root_Child1_Child6><Root_Child1_Child7>Auth</Root_Child1_Child7><Root_Child1_Child8>0668186410141228CREXP</Root_Child1_Child8></Root_Child1><Root_Child2><Root_Child2_Child1>13/10/2014</Root_Child2_Child1><Root_Child2_Child2>150.00</Root_Child2_Child2><Root_Child2_Child3>TXN</Root_Child2_Child3><Root_Child2_Child4>IX</Root_Child2_Child4><Root_Child2_Child5>SZM</Root_Child2_Child5><Root_Child2_Child6>For 14/10/14 Taxi Airport Trip</Root_Child2_Child6><Root_Child2_Child7>132</Root_Child2_Child7><Root_Child2_Child8>10</Root_Child2_Child8><Root_Child2_Child9>010006681864</Root_Child2_Child9></Root_Child2><Root_Child2><Root_Child2_Child1>13/10/2014</Root_Child2_Child1><Root_Child2_Child2>150.00</Root_Child2_Child2><Root_Child2_Child3>TXN</Root_Child2_Child3><Root_Child2_Child4>IX</Root_Child2_Child4><Root_Child2_Child5>SZM</Root_Child2_Child5><Root_Child2_Child6>For 14/10/14 Taxi Airport Trip</Root_Child2_Child6><Root_Child2_Child7>132</Root_Child2_Child7><Root_Child2_Child8>10</Root_Child2_Child8><Root_Child2_Child9>010006681864</Root_Child2_Child9></Root_Child2></RepeatingChildern><RepeatingChildern xmlns=""><Root_Child1><Root_Child1_Child1>P701760</Root_Child1_Child1><Root_Child1_Child2>GBP</Root_Child1_Child2><Root_Child1_Child3>LOND</Root_Child1_Child3><Root_Child1_Child4>0668373910141228</Root_Child1_Child4><Root_Child1_Child5>14/10/2014</Root_Child1_Child5><Root_Child1_Child6>650.00</Root_Child1_Child6><Root_Child1_Child7>Auth</Root_Child1_Child7><Root_Child1_Child8>0668373910141228CREXP</Root_Child1_Child8></Root_Child1><Root_Child2><Root_Child2_Child1>13/10/2014</Root_Child2_Child1><Root_Child2_Child2>650.00</Root_Child2_Child2><Root_Child2_Child3>TXN</Root_Child2_Child3><Root_Child2_Child4>IX</Root_Child2_Child4><Root_Child2_Child5>SZM</Root_Child2_Child5><Root_Child2_Child6>For14/10/14 Flight</Root_Child2_Child6><Root_Child2_Child7>264</Root_Child2_Child7><Root_Child2_Child8>10</Root_Child2_Child8><Root_Child2_Child9>010006683739</Root_Child2_Child9></Root_Child2></RepeatingChildern></Root>


    Bill Chesnut | BizTalk Server MVP | Mexia Consulting | Melbourne Australia
    http://www.biztalkbill.com | http://www.mexia.com.au
    Please indicate "Mark as Answer" if this post has answered the question.

    • Marked as answer by shivkat Wednesday, October 29, 2014 11:29 AM
    Wednesday, October 29, 2014 9:36 AM
  • Excellent. Worked perfect. Thank you very much.
    Wednesday, October 29, 2014 11:29 AM