Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail)

The file adapter is a very powerlful tool to read files with structured data. Most of the time you will read simple csv files with one record per row. But what if your csv file contains multiple records with different types. Even then you can use the file adapter.

Case

Assume you have some laptimes of the wordcup Worldcup speedskating. Saved as csv format this file looks as followed:

Pair 1;
Innerlane;Outerlane;
45;M. ANESI;ITA;126;R. BEDFORD;USA
Distance:;Time:;Lap:;Distance:;Time:;Lap:
300m;23.87;23.8;300m;24.54;24.5
700m;50.96;27;700m;51.56;27
1100m;01:19.2;28.2;1100m;01:20.0;28.4
1500m;01:49.3;30;1500m;01:50.2;30.2
Pair 2;
Innerlane;Outerlane;
124;J. ERIKSSON;SWE;122;A. YESIN;RUS
Distance:;Time:;Lap:;Distance:;Time:;Lap:
300m;24.02;24;300m;23.89;23.8
700m;
etc..
etc..

When we examine the file we can determine 5 records:

Pair 1; –rec 1
Innerlane;Outerlane; –rec 2
45;M. ANESI;ITA;126;R. BEDFORD;USA –rec 3
Distance:;Time:;Lap:;Distance:;Time:;Lap: –rec 4
300m;23.87;23.8;300m;24.54;24.5 –rec 5 repeating 4 times
700m;50.96;27;700m;51.56;27
1100m;01:19.2;28.2;1100m;01:20.0;28.4
1500m;01:49.3;30;1500m;01:50.2;30.2

By using the knowledge of how the data is repeating we can use the file adapter to read the file.

Tutorial

1. Start JDeveloper
2. Create a new SOA Application by choosing menu option “File” -> “New”.
3. From cateory “General” -> “Applications”, choose “SOA Application” and click “Ok”.
4. Enter as application name “Speedskating”. Press Next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) crea app sopa1a
5. Enter as project name “Speedskating”. Press Next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) cre app soa 1
6. Enter as composite name SpeedSkating. Select the ‘Empty Composite’ as composite template

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) cre app soa 2
7. Drag an instance of the file adapter to the exposed service swimlane.
8. This will launch the ‘Adapter Configuration Wizard. In the the ‘Welcome to the Adapter Configuration Wizard, press next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 31 File adapter1

9. Enter the name ‘ReadSkateResult’ for the service and press next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 32 file adapter1
10. Leave the default selected interface and press next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 33 file adapter

12. Select radio button read file and set the Operation Name to ‘ReadSpeedResult’. Press next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 34 file adapter

13. Enter the directory where csv files is located. Notice the the selected checkbox ‘Delete files after succesful retrieval’. We want our service to process the file one time. After each Speedskate event we can place a new file with new results in the directory to process. Press next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 35 file adapter
14. Enter the in field ‘Include files..’ the value ‘*worldcup*.csv. Press next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 36 file adapter
15. Change the polling frequency to 2 minutes. Later when our services succesfully has been tested and deployed succesfully we can change this value. Press next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 37 file adapter
16. Now we will create our own schema. Click the gear button.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 38 file adapter 9
17. Select the radio button ‘Delimeted’. Press next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 41 file adapter nfb1
18. Browse for the csv file. Notice that the content of the file is loaded. The other setting we will not change. Press next.
The complete csv can be copied here.

<br />
Pair 1;<br />
Innerlane;Outerlane;<br />
45;M. ANESI;ITA;126;R. BEDFORD;USA<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;23.87;23.8;300m;24.54;24.5<br />
700m;50.96;27;700m;51.56;27<br />
1100m;01:19.2;28.2;1100m;01:20.0;28.4<br />
1500m;01:49.3;30;1500m;01:50.2;30.2<br />
Pair 2;<br />
Innerlane;Outerlane;<br />
124;J. ERIKSSON;SWE;122;A. YESIN;RUS<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;24.02;24;300m;23.89;23.8<br />
700m;50.94;26.9;700m;50.71;26.8<br />
1100m;01:19.7;28.7;1100m;01:18.9;28.2<br />
1500m;01:50.5;30.7;1500m;01:48.3;29.3<br />
Pair 3;<br />
Innerlane;Outerlane;<br />
60;D. BABENKO;KAZ;40;R. LEHMANN;GER<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;25.05;25;300m;24.19;24.1<br />
700m;52.27;27.2;700m;51.53;27.3<br />
1100m;01:20.1;27.8;1100m;01:19.9;28.3<br />
1500m;01:48.7;28.5;1500m;01:48.9;29<br />
Pair 4;<br />
Innerlane;Outerlane;<br />
98;M. FLYGIND-LARSEN;NOR;13;P. RIOPEL;CAN<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;23.91;23.9;300m;24;24<br />
700m;50.01;26.1;700m;50.62;26.6<br />
1100m;01:17.6;27.5;1100m;01:19.4;28.7<br />
1500m;01:46.7;29.1;1500m;01:50.2;30.8<br />
Pair 5;<br />
Innerlane;Outerlane;<br />
82;R. KET;NED;109;K. NIEDZWIEDZKI;POL<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;23.55;23.5;300m;23.84;23.8<br />
700m;49.89;26.3;700m;50.88;27<br />
1100m;01:17.7;27.8;1100m;01:19.9;29<br />
1500m;01:47.8;30;1500m;01:50.2;30.3<br />
Pair 6;<br />
Innerlane;Outerlane;<br />
116;Y. LALENKOV;RUS;68;J. LEE;KOR<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;23.77;23.7;300m;23.85;23.8<br />
700m;50.19;26.4;700m;50.11;26.2<br />
1100m;01:17.5;27.3;1100m;01:18.4;28.2<br />
1500m;01:47.6;30;1500m;01:48.3;29.9<br />
Pair 7;<br />
Innerlane;Outerlane;<br />
130;J. KUCK;USA;10;L. MAKOWSKY;CAN<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;24.75;24.7;300m;24.45;24.4<br />
700m;51.34;26.5;700m;50.91;26.4<br />
1100m;01:18.7;27.3;1100m;01:18.4;27.4<br />
1500m;01:47.3;28.6;1500m;01:47.3;28.9<br />
Pair 8;<br />
Innerlane;Outerlane;<br />
80;S. GROOTHUIS;NED;121;I. SKOBREV;RUS<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;23.67;23.6;300m;24.57;24.5<br />
700m;49.49;25.8;700m;51.63;27<br />
1100m;01:16.7;27.2;1100m;01:18.9;27.2<br />
1500m;01:46.4;29.6;1500m;01:47.1;28.2<br />
Pair 9;<br />
Innerlane;Outerlane;<br />
47;E. FABRIS;ITA;88;W. OLDE HEUVEL;NED<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;24.45;24.4;300m;24.18;24.1<br />
700m;51.45;27;700m;51.07;26.8<br />
1100m;01:18.9;27.4;1100m;01:18.5;27.4<br />
1500m;01:46.9;28;1500m;01:46.8;28.2<br />
Pair 10;<br />
Innerlane;Outerlane;<br />
131;T. MARSICANO;USA;92;M. TUITERT;NED<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;23.91;23.9;300m;23.71;23.7<br />
700m;50.03;26.1;700m;49.59;25.8<br />
1100m;01:17.4;27.3;1100m;01:16.8;27.2<br />
1500m;01:47.4;29.9;1500m;01:46.0;29.1<br />
Pair 11;<br />
Innerlane;Outerlane;<br />
85;S. KUIPERS;NED;128;S. DAVIS;USA<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;23.55;23.5;300m;23.56;23.5<br />
700m;49.53;25.9;700m;49.11;25.5<br />
1100m;01:16.7;27.1;1100m;01:16.2;27.1<br />
1500m;01:45.5;28.7;1500m;01:45.0;28.8<br />
Pair 12;<br />
Innerlane;Outerlane;<br />
11;D. MORRISON;CAN;96;H. BØKKO;NOR<br />
Distance:;Time:;Lap:;Distance:;Time:;Lap:<br />
300m;26.65;26.6;300m;23.85;23.8<br />
700m;52.87;26.2;700m;50.52;26.6<br />
1100m;01:20.5;27.6;1100m;01:18.4;27.8<br />
1500m;01:50.4;29.8;1500m;01:47.2;28.8</p>
<p>

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 42 file adapter nfb2
19. Select the radio buttons ‘File Contains multiple record instances’, ‘Multiple records are of different type’. Press next.

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 43 file adapter nfb3
20. Our file contains 5 different records. The colored rectangles contain the inforbmation we are interested in.

  • Red:pair
  • Green:Riders
  • Blue:Laps
  • The remainder data we can sonsider as ‘metadata’.
    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 44 file adapter nfb4

    21. Notice that the field delimiters are set to semicolon. Press next.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 45 file adapter nfb5
    22. Unfortunately we can not make use of the functionality offered in this step. We have to manually change our xsd later. Press next.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 46 file adapter nfb6
    Press next.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 47 file adapter nfb7

    23. So now we have an generated xsd. Let’s give it a try and test it by pressing the test button.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 48 file adapter 11 nfb8
    24. An error was to be expected. We did almost nothing till now. So why should it work ;-). Press ok twice to close the error message and the test window.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 49 file adapter 11 nfb9
    25. In our csv file we have a “list of elements”. The file adapter generated a xsd with a ‘choice’ element. This combination is causing the fault. We have to replace this by a sequence tag to match our list of ‘elements’ in our csv. Not forget to change the closing ‘choice’ tag also. Let’s test again by pressing the test button.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 50 file adapter 11 nfb10
    26. Although the xsd is not well formatted we can test it succesfully. WARNING: do not use the back button all changes you have made in your xsd will be lost.


    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 51 file adapter 11 nfb11
    27. Click on the link below to see the complete generated xsd. If we take a closer look we see that for every row in our csv file a record element has been generated. This is not what we want. First of all we want more clear names for the elements in our xsd. Second we want one element with data for one pair of riders. See step 20. Press ok to close the test window
    28. Our revised xsd is shown in the second source block. Copy the content of this to the ‘Native Format Builder Step 8 of 8’ xsd editor.

    <xsd:element name="Root-Element">
        <xsd:complexType>
          <xsd:choice minOccurs="1" maxOccurs="unbounded" nxsd:choiceCondition="terminated" nxsd:terminatedBy=";">
            <xsd:element name="RECORD1" nxsd:conditionValue="Pair 1">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD10" nxsd:conditionValue="124">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD11" nxsd:conditionValue="Pair 3">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD12" nxsd:conditionValue="60">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD13" nxsd:conditionValue="Pair 4">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD14" nxsd:conditionValue="98">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD15" nxsd:conditionValue="Pair 5">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD16" nxsd:conditionValue="82">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD17" nxsd:conditionValue="Pair 6">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD18" nxsd:conditionValue="116">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD19" nxsd:conditionValue="Pair 7">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD2" nxsd:conditionValue="Innerlane">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD20" nxsd:conditionValue="130">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD21" nxsd:conditionValue="Pair 8">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD22" nxsd:conditionValue="80">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD23" nxsd:conditionValue="Pair 9">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD24" nxsd:conditionValue="47">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD25" nxsd:conditionValue="Pair 10">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD26" nxsd:conditionValue="131">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD27" nxsd:conditionValue="Pair 11">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD28" nxsd:conditionValue="85">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD29" nxsd:conditionValue="Pair 12">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD3" nxsd:conditionValue="45">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD30" nxsd:conditionValue="11">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD4" nxsd:conditionValue="Distance:">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD5" nxsd:conditionValue="300m">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD6" nxsd:conditionValue="700m">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD7" nxsd:conditionValue="1100m">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD8" nxsd:conditionValue="1500m">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C4" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C6" type="xsd:decimal" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="RECORD9" nxsd:conditionValue="Pair 2">
              <xsd:complexType>
                <xsd:sequence>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
          </xsd:choice>
        </xsd:complexType>
      </xsd:element>
    
    </xsd:schema>

    29. Notice line 17 and 18. The attribute maxOccurs in line 17 has been added to process all ‘records’ in our csv file and not just one (see below). Also we added and element pair to group each pair of riders. As you can see all record elements have been removed.
    Pair 1;
    Innerlane;Outerlane;
    45;M. ANESI;ITA;126;R. BEDFORD;USA
    Distance:;Time:;Lap:;Distance:;Time:;Lap:
    300m;23.87;23.8;300m;24.54;24.5
    700m;50.96;27;700m;51.56;27
    1100m;01:19.2;28.2;1100m;01:20.0;28.4
    1500m;01:49.3;30;1500m;01:50.2;30.2

    <?xml version="1.0" encoding="UTF-8" ?>
    
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
                xmlns:tns="http://TargetNamespace.com/ReadSkateResult"
                targetNamespace="http://TargetNamespace.com/ReadSkateResult"
                elementFormDefault="qualified"
                attributeFormDefault="unqualified"
    
                nxsd:version="NXSD"
                nxsd:stream="chars"
                nxsd:encoding="ASCII"
    >
    
    
      <xsd:element name="Root-Element">
        <xsd:complexType>
          <xsd:sequence maxOccurs="unbounded">
            <xsd:element name="Pair">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="PairNo" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";${eol}" nxsd:quotedBy="&quot;" />
                    <xsd:element name="InnOut" >
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="Inn" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                                <xsd:element name="Out" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";${eol}" nxsd:quotedBy="&quot;" />
                         </xsd:sequence>
                     </xsd:complexType>
                  </xsd:element>
    
                <xsd:element name="Riders" >
                 <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="RideInn" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                        <xsd:element name="NameInn" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                        <xsd:element name="CountryInn" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                        <xsd:element name="RiderOut" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                        <xsd:element name="NameOut" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                        <xsd:element name="CountryOut" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                        </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
    
            <xsd:element name="DistanceHeading" >
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="h1" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="h2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="h3" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="h4" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="h5" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="h6" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
            <xsd:element name="Distance"  minOccurs="4" maxOccurs="4">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="DistanceInner" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="TimeInner" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="LapInner" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="DistanceOut" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="TimeOut" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="LapOut" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
    
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
    
    
    
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    
    </xsd:schema>
    <!--NXSDWIZ:D:\blog\essent_worldcup.csv:-->
    <!--USE-HEADER:false:-->

    30. When perform a test again we will get the following output.

    <Root-Element xmlns="http://TargetNamespace.com/ReadSpeedSkate">
       <Pair>
          <Ride>Pair 1</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>45</RiderInr>
             <NameInr>M.?ANESI</NameInr>
             <CountryIn>ITA</CountryIn>
             <RiderOut>126</RiderOut>
             <NameOut>R.?BEDFORD</NameOut>
             <CountryIOut>USA</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>23.87</TimeInn>
             <LapInn>23.8</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>24.54</TimeOut>
             <LapOut>24.5</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>50.96</TimeInn>
             <LapInn>27</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>51.56</TimeOut>
             <LapOut>27</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:19.2</TimeInn>
             <LapInn>28.2</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:20.0</TimeOut>
             <LapOut>28.4</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:49.3</TimeInn>
             <LapInn>30</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:50.2</TimeOut>
             <LapOut>30.2</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 2</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>124</RiderInr>
             <NameInr>J.?ERIKSSON</NameInr>
             <CountryIn>SWE</CountryIn>
             <RiderOut>122</RiderOut>
             <NameOut>A.?YESIN</NameOut>
             <CountryIOut>RUS</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>24.02</TimeInn>
             <LapInn>24</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>23.89</TimeOut>
             <LapOut>23.8</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>50.94</TimeInn>
             <LapInn>26.9</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>50.71</TimeOut>
             <LapOut>26.8</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:19.7</TimeInn>
             <LapInn>28.7</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:18.9</TimeOut>
             <LapOut>28.2</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:50.5</TimeInn>
             <LapInn>30.7</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:48.3</TimeOut>
             <LapOut>29.3</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 3</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>60</RiderInr>
             <NameInr>D.?BABENKO</NameInr>
             <CountryIn>KAZ</CountryIn>
             <RiderOut>40</RiderOut>
             <NameOut>R.?LEHMANN</NameOut>
             <CountryIOut>GER</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>25.05</TimeInn>
             <LapInn>25</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>24.19</TimeOut>
             <LapOut>24.1</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>52.27</TimeInn>
             <LapInn>27.2</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>51.53</TimeOut>
             <LapOut>27.3</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:20.1</TimeInn>
             <LapInn>27.8</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:19.9</TimeOut>
             <LapOut>28.3</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:48.7</TimeInn>
             <LapInn>28.5</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:48.9</TimeOut>
             <LapOut>29</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 4</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>98</RiderInr>
             <NameInr>M.?FLYGIND-LARSEN</NameInr>
             <CountryIn>NOR</CountryIn>
             <RiderOut>13</RiderOut>
             <NameOut>P.?RIOPEL</NameOut>
             <CountryIOut>CAN</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>23.91</TimeInn>
             <LapInn>23.9</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>24</TimeOut>
             <LapOut>24</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>50.01</TimeInn>
             <LapInn>26.1</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>50.62</TimeOut>
             <LapOut>26.6</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:17.6</TimeInn>
             <LapInn>27.5</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:19.4</TimeOut>
             <LapOut>28.7</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:46.7</TimeInn>
             <LapInn>29.1</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:50.2</TimeOut>
             <LapOut>30.8</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 5</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>82</RiderInr>
             <NameInr>R.?KET</NameInr>
             <CountryIn>NED</CountryIn>
             <RiderOut>109</RiderOut>
             <NameOut>K.?NIEDZWIEDZKI</NameOut>
             <CountryIOut>POL</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>23.55</TimeInn>
             <LapInn>23.5</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>23.84</TimeOut>
             <LapOut>23.8</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>49.89</TimeInn>
             <LapInn>26.3</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>50.88</TimeOut>
             <LapOut>27</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:17.7</TimeInn>
             <LapInn>27.8</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:19.9</TimeOut>
             <LapOut>29</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:47.8</TimeInn>
             <LapInn>30</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:50.2</TimeOut>
             <LapOut>30.3</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 6</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>116</RiderInr>
             <NameInr>Y.?LALENKOV</NameInr>
             <CountryIn>RUS</CountryIn>
             <RiderOut>68</RiderOut>
             <NameOut>J.?LEE</NameOut>
             <CountryIOut>KOR</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>23.77</TimeInn>
             <LapInn>23.7</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>23.85</TimeOut>
             <LapOut>23.8</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>50.19</TimeInn>
             <LapInn>26.4</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>50.11</TimeOut>
             <LapOut>26.2</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:17.5</TimeInn>
             <LapInn>27.3</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:18.4</TimeOut>
             <LapOut>28.2</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:47.6</TimeInn>
             <LapInn>30</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:48.3</TimeOut>
             <LapOut>29.9</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 7</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>130</RiderInr>
             <NameInr>J.?KUCK</NameInr>
             <CountryIn>USA</CountryIn>
             <RiderOut>10</RiderOut>
             <NameOut>L.?MAKOWSKY</NameOut>
             <CountryIOut>CAN</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>24.75</TimeInn>
             <LapInn>24.7</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>24.45</TimeOut>
             <LapOut>24.4</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>51.34</TimeInn>
             <LapInn>26.5</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>50.91</TimeOut>
             <LapOut>26.4</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:18.7</TimeInn>
             <LapInn>27.3</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:18.4</TimeOut>
             <LapOut>27.4</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:47.3</TimeInn>
             <LapInn>28.6</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:47.3</TimeOut>
             <LapOut>28.9</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 8</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>80</RiderInr>
             <NameInr>S.?GROOTHUIS</NameInr>
             <CountryIn>NED</CountryIn>
             <RiderOut>121</RiderOut>
             <NameOut>I.?SKOBREV</NameOut>
             <CountryIOut>RUS</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>23.67</TimeInn>
             <LapInn>23.6</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>24.57</TimeOut>
             <LapOut>24.5</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>49.49</TimeInn>
             <LapInn>25.8</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>51.63</TimeOut>
             <LapOut>27</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:16.7</TimeInn>
             <LapInn>27.2</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:18.9</TimeOut>
             <LapOut>27.2</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:46.4</TimeInn>
             <LapInn>29.6</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:47.1</TimeOut>
             <LapOut>28.2</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 9</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>47</RiderInr>
             <NameInr>E.?FABRIS</NameInr>
             <CountryIn>ITA</CountryIn>
             <RiderOut>88</RiderOut>
             <NameOut>W.?OLDE HEUVEL</NameOut>
             <CountryIOut>NED</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>24.45</TimeInn>
             <LapInn>24.4</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>24.18</TimeOut>
             <LapOut>24.1</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>51.45</TimeInn>
             <LapInn>27</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>51.07</TimeOut>
             <LapOut>26.8</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:18.9</TimeInn>
             <LapInn>27.4</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:18.5</TimeOut>
             <LapOut>27.4</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:46.9</TimeInn>
             <LapInn>28</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:46.8</TimeOut>
             <LapOut>28.2</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 10</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>131</RiderInr>
             <NameInr>T.?MARSICANO</NameInr>
             <CountryIn>USA</CountryIn>
             <RiderOut>92</RiderOut>
             <NameOut>M.?TUITERT</NameOut>
             <CountryIOut>NED</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>23.91</TimeInn>
             <LapInn>23.9</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>23.71</TimeOut>
             <LapOut>23.7</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>50.03</TimeInn>
             <LapInn>26.1</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>49.59</TimeOut>
             <LapOut>25.8</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:17.4</TimeInn>
             <LapInn>27.3</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:16.8</TimeOut>
             <LapOut>27.2</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:47.4</TimeInn>
             <LapInn>29.9</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:46.0</TimeOut>
             <LapOut>29.1</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 11</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>85</RiderInr>
             <NameInr>S.?KUIPERS</NameInr>
             <CountryIn>NED</CountryIn>
             <RiderOut>128</RiderOut>
             <NameOut>S.?DAVIS</NameOut>
             <CountryIOut>USA</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>23.55</TimeInn>
             <LapInn>23.5</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>23.56</TimeOut>
             <LapOut>23.5</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>49.53</TimeInn>
             <LapInn>25.9</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>49.11</TimeOut>
             <LapOut>25.5</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:16.7</TimeInn>
             <LapInn>27.1</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:16.2</TimeOut>
             <LapOut>27.1</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:45.5</TimeInn>
             <LapInn>28.7</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:45.0</TimeOut>
             <LapOut>28.8</LapOut>
          </Round>
       </Pair>
       <Pair>
          <Ride>Pair 12</Ride>
          <In_out_heading>
             <RiderInr>Innerlane</RiderInr>
             <RiderOut>Outerlane</RiderOut>
          </In_out_heading>
          <Deelnemers>
             <RiderInr>11</RiderInr>
             <NameInr>D.?MORRISON</NameInr>
             <CountryIn>CAN</CountryIn>
             <RiderOut>96</RiderOut>
             <NameOut>H.?B?KKO</NameOut>
             <CountryIOut>NOR</CountryIOut>
          </Deelnemers>
          <Distance>
             <heading1>Distance:</heading1>
             <heading2>Time:</heading2>
             <heading3>Lap:</heading3>
             <heading4>Distance:</heading4>
             <heading5>Time:;Lap:</heading5>
          </Distance>
          <Round>
             <DistInn>300m</DistInn>
             <TimeInn>26.65</TimeInn>
             <LapInn>26.6</LapInn>
             <DistOut>300m</DistOut>
             <TimeOut>23.85</TimeOut>
             <LapOut>23.8</LapOut>
          </Round>
          <Round>
             <DistInn>700m</DistInn>
             <TimeInn>52.87</TimeInn>
             <LapInn>26.2</LapInn>
             <DistOut>700m</DistOut>
             <TimeOut>50.52</TimeOut>
             <LapOut>26.6</LapOut>
          </Round>
          <Round>
             <DistInn>1100m</DistInn>
             <TimeInn>01:20.5</TimeInn>
             <LapInn>27.6</LapInn>
             <DistOut>1100m</DistOut>
             <TimeOut>01:18.4</TimeOut>
             <LapOut>27.8</LapOut>
          </Round>
          <Round>
             <DistInn>1500m</DistInn>
             <TimeInn>01:50.4</TimeInn>
             <LapInn>29.8</LapInn>
             <DistOut>1500m</DistOut>
             <TimeOut>01:47.2</TimeOut>
             <LapOut>28.8</LapOut>
          </Round>
       </Pair>

    31. This output we can use in our mediator. Press next to finish the Native format builder.
    32. Now we have to create a database adapter to insert the Speedskaters in our database.
    In our example we will insert them in the table riders

    create table RIDERS
    (
      PAIR         VARCHAR2(10),
      RIDERINN     VARCHAR2(40),
      RIDERNAMEINN VARCHAR2(40),
      COUNTRYINN   VARCHAR2(40),
      RIDEROUT     VARCHAR2(40),
      RIDERNAMEOUT VARCHAR2(40),
      COUNTRYOUT   VARCHAR2(40)
    )
    
    

    33. Drag and drop the database adapter in the external references swinlane of the composite diagram. Press next in the welcome screen.

    34. Enter as servive name “dbSpeedSkate”. Press next.
    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 61 db 2

    35. Configure your database and select the correct connection and enter the correct JNDI name. For more information about configuring your database connection read the blogpost Oracle 11g SOA Suite-Service…. Press next.
    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 62 db 3

    36. Select the radio button “Perform an Operation on a Table’ and select the checkbox “Insert Only”. Press Next.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 63 db 4

    37. Use the import wizard to select the table riders created in step 30. Press next.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 64 db 5

    38. Select the checkboxes pair,riderinn,riderout to define a primary key . Normaly you would define a primary key in the database.
    Because the primary goal of this tutorial is to learn the file adapter we will not pay much attention to this.
    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 65 db 6

    39. Press next in step 7 relationships
    Press next in step 8 filtering
    Press next in step 9 advanced
    Press finish.

    40. Got back to composite diagram and add a mediator service component to the component swinlane.
    41. Enter the name ‘MediatorSpeedSkate’ as name for the mediator. Accept the default Template ‘Define Interface Later’. Press ok.
    42.

    • Connect the exposed service ‘ReadSkateResults’ in the left swinlane with the mediator
    • Connect the mediator with de exterlan reference dbSpeedSkate in the right swimlane

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) 73 mediator 12

    43. The next step is to configure the routing rules for the mediator. Double click on the mediator “MediatorspeedSkate” to start editing.
    44. Press the button just right of the drop down list ‘Transform Using’
    45. Select the radio button ‘Create New Mapper File’. Accept the deault mapper file name and press ok.
    46. Remember that our csv contains multiple pairs or riders. These have to be processed one-by-one. We need to tell this to the mapper by using a for each xslt element

    • In the xslt Constructs there is a for-each element. Drag and drop the for-each element just between the elements ‘RidersCollection’ and ‘Riders’
    • Connect the rider elements in the left panel with the riders in the right panel as shown in the image.
    • When you are ready save all changes.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) mapper 1
    47. Deploy the application

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) deploy 1
    48. Check the Enterprise manager for the deployed application. Your application should be visible


    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) soa console 1
    49. Looking at the dashboard tab, region ‘Recent Instances’ we can see that our application has already. Remeber that we told the file adapter to run every 2 minutes. If the instance has not run succesfull you meaby forgot to place the csv file in the correct directory.
    50. Looking at the instance trail we can see the data has succesfully passed to the database.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) soa console 3aa
    51. Let’s check or the data is in the database table riders.

    Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail) db result

    Resume

    We created a succesful service to read the content of a file into the database. Although it would be likely to structure our data more elegant with the mediator. We succeeded in reading a file with multiple records with different types.
    The next step will be make use of an other xslt construct e.g. ‘if’. The data can then be made more structured.

    5 Comments

    1. pankaj May 9, 2014
    2. radiantracy March 24, 2014
    3. Bishnu October 17, 2011
    4. Rajasekhar Yandrapu July 27, 2011
    5. Lucas Jellema December 31, 2010