title: Schema for Flat File
body: <p>I have to do to a transformation from flatfile to xml but the problem is that the flatfile has multiple child nodes and the child nodes have sub nodes as well. The records are occuring multiple times in the file. I had created a schema but it processes only single record.
  Can you please tell me the structure of the schema I should create that can process mulitple records.</p>
  <p>Here is the flat file.</p>
  <pre><code>ASN,000589,,0000768,
  HDR,0008289,0040294A,LA,00,1570,21,TM,,,M,PE,Corporation,120276,052451,05-00289,05-08299,02,LA,B,011,C,BD ,8,LA,16570,24,ST,,N,GETRO,GETRO,120246,054551,LA,0000568,8018279,
  POH,0508289,004024A,1,PPO000199,LA,NP,00,13615,13563,13414,1351,2584,,3598,2900,,,A200,B200,HN,18552,1270,,N,GETRO,GETRO,1206,05451,LA,0000768,
  LNE,0005289,00402929     ,1,1,PPO000099,AP,00,8719,00704,2536,DW,3870,DW,CC,0930-01,05-08289,,N,GETRO,GETRO,13246,05751,LA,00005668,2,
  PCK,A0722,4786149,100,2536,LA,
  LNE,0005089,0040294A     ,2,1,PPO0000199,OP,00,82664,001822,890,HW,3500,HW,CC,0656-01,05-08289,,N,GETRO,GETRO,120246,054551,LA,000052768,4,
  PCK,031992,48005,12,8290,LA,
  LNE,0005289,004029A     ,2,2,PPO0000199,AP,00,872087,0000859,5744,HN,367500,HW,CD,098656-02,05-08289,,N,GETRO,GETRO,120246,054551,LA,00005768,3,
  PCK,04022,479782,100,2872,LA,
  PCK,04023,4797288,100,2872,LA,
  ASN,000521288,004679294A,000075667,
  HDR,000788288,004024594A,LA,00,33758,01,TM,,,M,PP,Corporation,120246,054551,05-08289,05-08289,01,LA,B,011,C,BA ,8,LA,33158,24,ST,,N,GETRO,GETRO,120246,054551,LA,000672767,8056279,
  POH,000508288,004029294A,1,PPO000000199,LA,AP,00,1360415,1350063,1346914,13501,258304,,35698,2900,,,D250,D290,HQ,10352,33158,,N,GETRO,GETRO,120246,054551,LA,000052767,
  LNE,0005288,0040294A     ,1,2,PPO0000199,OP,00,874402,30001281,33158,HA,377500,HA,CC,098630-02,05-08289,,N,GETRO,GETRO,120246,054551,LA,00002767,1,
  PCK,03134,480075,12,8290,LA,
  PCK,03114,480076,12,8290,LA,
  PCK,94985,480579,12,8290,LA,
  PCK,94995,480080,12,8290,LA,
  </code></pre>
  <p>Here is the schema I have created</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-16&quot;?&gt;
  
  -&lt;xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; targetNamespace=&quot;http://Test.InputSchema&quot; xmlns:b=&quot;http://schemas.microsoft.com/BizTalk/2003&quot; xmlns=&quot;http://Test.InputSchema&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;schemaEditorExtension:schemaInfo xmlns:schemaEditorExtension=&quot;http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions&quot; standardName=&quot;Flat File&quot; extensionClass=&quot;Microsoft.Azure.Integration.DesignTools.FlatFileExtension.FlatFileExtension&quot; namespaceAlias=&quot;b&quot;/&gt;
  
  &lt;b:schemaInfo root_reference=&quot;Root&quot; default_child_order=&quot;infix&quot; default_child_delimiter=&quot;,&quot; child_delimiter_type=&quot;char&quot; compile_parse_tables=&quot;false&quot; allow_message_breakup_of_infix_root=&quot;false&quot; early_terminate_optional_fields=&quot;false&quot; allow_early_termination=&quot;false&quot; generate_empty_nodes=&quot;true&quot; suppress_empty_nodes=&quot;false&quot; lookahead_depth=&quot;3&quot; parser_optimization=&quot;speed&quot; count_positions_by_byte=&quot;false&quot; pad_char_type=&quot;char&quot; default_pad_char=&quot; &quot; codepage=&quot;65001&quot; standard=&quot;Flat File&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:element name=&quot;Root&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:recordInfo child_delimiter_type=&quot;hex&quot; suppress_trailing_delimiters=&quot;false&quot; preserve_delimiter_for_empty_data=&quot;true&quot; sequence_number=&quot;1&quot; child_order=&quot;postfix&quot; child_delimiter=&quot;0x0D 0x0A&quot; structure=&quot;delimited&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:complexType&gt;
  
  
  -&lt;xs:sequence&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:groupInfo sequence_number=&quot;0&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:sequence maxOccurs=&quot;unbounded&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:groupInfo sequence_number=&quot;1&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:element name=&quot;ASN&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:recordInfo child_delimiter_type=&quot;default&quot; suppress_trailing_delimiters=&quot;false&quot; preserve_delimiter_for_empty_data=&quot;true&quot; sequence_number=&quot;1&quot; child_order=&quot;default&quot; structure=&quot;delimited&quot; tag_name=&quot;ASN,&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:complexType&gt;
  
  
  -&lt;xs:sequence&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:groupInfo sequence_number=&quot;0&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:element name=&quot;Field&quot; maxOccurs=&quot;unbounded&quot; type=&quot;xs:string&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:fieldInfo sequence_number=&quot;1&quot; justification=&quot;left&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  &lt;/xs:element&gt;
  
  &lt;/xs:sequence&gt;
  
  &lt;/xs:complexType&gt;
  
  &lt;/xs:element&gt;
  
  
  -&lt;xs:element name=&quot;HDR&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:recordInfo child_delimiter_type=&quot;default&quot; suppress_trailing_delimiters=&quot;false&quot; preserve_delimiter_for_empty_data=&quot;true&quot; sequence_number=&quot;2&quot; child_order=&quot;default&quot; structure=&quot;delimited&quot; tag_name=&quot;HDR,&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:complexType&gt;
  
  
  -&lt;xs:sequence&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:groupInfo sequence_number=&quot;0&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:element name=&quot;Field&quot; maxOccurs=&quot;unbounded&quot; type=&quot;xs:string&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:fieldInfo sequence_number=&quot;1&quot; justification=&quot;left&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  &lt;/xs:element&gt;
  
  &lt;/xs:sequence&gt;
  
  &lt;/xs:complexType&gt;
  
  &lt;/xs:element&gt;
  
  
  -&lt;xs:element name=&quot;POH&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:recordInfo child_delimiter_type=&quot;default&quot; suppress_trailing_delimiters=&quot;false&quot; preserve_delimiter_for_empty_data=&quot;true&quot; sequence_number=&quot;3&quot; child_order=&quot;default&quot; structure=&quot;delimited&quot; tag_name=&quot;POH,&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:complexType&gt;
  
  
  -&lt;xs:sequence&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:groupInfo sequence_number=&quot;0&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:element name=&quot;Field&quot; maxOccurs=&quot;unbounded&quot; type=&quot;xs:string&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:fieldInfo sequence_number=&quot;1&quot; justification=&quot;left&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  &lt;/xs:element&gt;
  
  &lt;/xs:sequence&gt;
  
  &lt;/xs:complexType&gt;
  
  &lt;/xs:element&gt;
  
  
  -&lt;xs:sequence maxOccurs=&quot;unbounded&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:groupInfo sequence_number=&quot;4&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:element name=&quot;LNE&quot; maxOccurs=&quot;unbounded&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:recordInfo child_delimiter_type=&quot;default&quot; suppress_trailing_delimiters=&quot;false&quot; preserve_delimiter_for_empty_data=&quot;true&quot; sequence_number=&quot;1&quot; child_order=&quot;default&quot; structure=&quot;delimited&quot; tag_name=&quot;LNE,&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:complexType&gt;
  
  
  -&lt;xs:sequence&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:groupInfo sequence_number=&quot;0&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:element name=&quot;Field&quot; maxOccurs=&quot;unbounded&quot; type=&quot;xs:string&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:fieldInfo sequence_number=&quot;1&quot; justification=&quot;left&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  &lt;/xs:element&gt;
  
  &lt;/xs:sequence&gt;
  
  &lt;/xs:complexType&gt;
  
  &lt;/xs:element&gt;
  
  
  -&lt;xs:element name=&quot;PCK&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:recordInfo child_delimiter_type=&quot;default&quot; suppress_trailing_delimiters=&quot;false&quot; preserve_delimiter_for_empty_data=&quot;true&quot; sequence_number=&quot;2&quot; child_order=&quot;default&quot; structure=&quot;delimited&quot; tag_name=&quot;PCK,&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:complexType&gt;
  
  
  -&lt;xs:sequence&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:groupInfo sequence_number=&quot;0&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  
  -&lt;xs:element name=&quot;Field&quot; maxOccurs=&quot;unbounded&quot; type=&quot;xs:string&quot;&gt;
  
  
  -&lt;xs:annotation&gt;
  
  
  -&lt;xs:appinfo&gt;
  
  &lt;b:fieldInfo sequence_number=&quot;1&quot; justification=&quot;left&quot;/&gt;
  
  &lt;/xs:appinfo&gt;
  
  &lt;/xs:annotation&gt;
  
  &lt;/xs:element&gt;
  
  &lt;/xs:sequence&gt;
  
  &lt;/xs:complexType&gt;
  
  &lt;/xs:element&gt;
  
  &lt;/xs:sequence&gt;
  
  &lt;/xs:sequence&gt;
  
  &lt;/xs:sequence&gt;
  
  &lt;/xs:complexType&gt;
  
  &lt;/xs:element&gt;
  
  &lt;/xs:schema&gt;
  </code></pre>