Conversion from an XML-format file to a format file
This section describes the conversion for each type of XML-format input file, using the same schema file.
The contents of the schema file are as follows:
(This example uses the sequence contents model.)

Figure 4.29 Schema file

Screen 4.11 XML information tree
(1) If the elements two levels below the root element are repeated (with repetitions at the output side)
This section describes the process for each XML record unit setting, taking as examples the following contents and mapping information of the input file:
Repetitions are set for the output side format information. The input and output data are mapped for the number of repetitions.

Figure 4.30 Input file

Screen 4.12 Input side (XML) and output side (FMT) mappings
a) If the XML record unit is "1"
The data between <root> and </root> is handled as one record. In this example, all data between <root> and </root> is contained in the output item and processed as one record.

Figure 4.31 Output file
b) If the XML record unit is "2"
The element of the level just below the root element <root> is handled as one record. In this example, only the <A> element exists in the level just below the root. Therefore, all data between <A> and </A> is contained in the output item and processed as one record.

Figure 4.32 Output file
c) If the XML record unit is "3"
The element of the level that is two levels below the root element <root> is handled as one record.
In this example, the data in the input file is processed from <A1> to <A3> as the first record, and then when the second <A1> occurs, the data is processed as the second record. The reason that the data is processed as the second record is that the second <A1> is connected with item1 under the second "data" of the output items on the mapping, while the XML record unit is set to "3".
As a result, the output is as shown below. For the items for which no input data is output, the default value for that field type is output.

Figure 4.33 Output file
d) If the XML record unit is "Element"
Records are handled based on the element that you have set as the extraction condition.
In this example, set element A as the extraction condition in the Add Extraction Condition screen.
The mapping screen is as follows:

Screen 4.13 Input side (XML) and output side (FMT) mappings
<A1> to <A3> under the element A are processed as one record.
As a result, the output is as follows:

Figure 4.34 Output file
(2) If the elements two levels below the root element are repeated (without repetitions at the output side)
Here is a case where repetitions are not set for the output side format information.
This section describes the case where only a part of the mapping information is configured, as shown below.
The same input file is used here.

Screen 4.14 Mapping information
a) If the XML record unit is "1"
The data between <root> and </root> is handled as one record. In this example, the values of the first <A1> to <A3> that have connections between <root> and </root> are contained in the output item and processed as one record. The data of unmapped items is truncated.

Figure 4.35 Output file
b) If the XML record unit is "2"
The element of the level just below the root element <root> is handled as one record. In this example, only the <A> element exists in the level just below the root. Therefore, the values of the first <A1> to <A3> that have connections between <A> and </A> are contained in the output item and processed as one record. The data of unmapped items is truncated.

Figure 4.36 Output file
c) If the XML record unit is "3"
The element of the level that is two levels below the root element <root> is handled as one record.
In this example, the elements <A1> to <A3>, which are two levels below the root, are processed as one record.

Figure 4.37 Output file
d) If the XML record unit is "Element"
A record is handled based on the element that you have set as the extraction condition.
In this example, set the element A as the extraction condition in the Add Extraction Condition screen.
The mapping screen is as follows:

Screen 4.15 Mapping information
<A1> to <A3> under the element A are processed as one record.
As a result, the output is as shown below.

Figure 4.38 Output file
(3) If the elements just below the root element are repeated (with repetitions at the output side)
This section describes the process for each XML record unit setting, taking the following contents and mapping information of the input file:
Repetitions are set for the output side format information. The input and output data are mapped for the number of repetitions.

Figure 4.39 Input file

Screen 4.16 Mapping information
a) If the XML record unit is "1"
The data between <root> and </root> is handled as one record. In this example, all data between <root> and </root> is contained in the output item and processed as one record.

Figure 4.40 Output file
b) If the XML record unit is "2"
The element of the level just below the root element <root> is handled as one record. In this example, the data in the input file is processed from <A> in descending order as the first record, and then when the second <A> occurs, the data is processed as the second record. The reason that the data is processed as the second record is that the second <A> is connected with item1 to item3 under the second "data" of the output items on the mapping, while the XML record unit is set to "2".
As a result, the output is as shown below. For the items for which no input data is output, the default value for that field type is output.

Figure 4.41 Output file
c) If the XML record unit is "3"
The element of the level that is two levels below the root element <root> is handled as one record.
In this example, multiple elements exist in the level just below the root. Therefore, when the second <A> occurs, an XML record unit consistency error occurs.
d) If the XML record unit is "Element"
Records are handled based on the element that you have set as the extraction condition.
In this example, set the element A as the extraction condition in the Add Extraction Condition screen.
The mapping screen is as follows:

Screen 4.17 Mapping information
<A1> to <A3> under the element A are processed as one record.
As a result, the output is as follows:

Figure 4.42 Output file
(4) If the elements just below the root element are repeated (without repetitions at the output side)
Here is a case where repetitions are not set for the output side format information.
This section describes the case where a part of the mapping information is configured as shown below.
The same input file is used here.

Screen 4.18 Mapping information
a) If the XML record unit is "1"
The data between <root> and </root> is handled as one record. In this example, therefore, the values of the first <A1> to <A3> that have connections between <root> and </root> are contained in the output item and processed as one record. The data of unmapped items is truncated.

Figure 4.43 Output file
b) If the XML record unit is "2"
The element of the level just below the root element <root> is handled as one record. In this example, four <A> exist just below the root. Therefore, four records are processed using the data of each <A> as one record.

Figure 4.44 Output file
c) If the XML record unit is "3"
The element of the level that is two levels below the root element <root> is handled as one record.
In this example, multiple elements exist in the level just below the root. Therefore, when the second <A> occurs, an XML record unit consistency error occurs.
d) If the XML record unit is "Element"
A record is handled based on the element that you have set as the extraction condition.
In this example, set the element A as the extraction condition in the Add Extraction Condition screen.
The mapping screen is as follows:

Screen 4.19 Mapping information
<A1> to <A3> under the element A are processed as one record.
As a result, the output is as follows:

Figure 4.45 Output file