Conversion from an XML-format file to an XML-format file

This section describes the conversion from an XML-format file to an XML-format file for each setting of the XML record unit, taking as examples the following input file and schema file:

Figure 4.57 Input file

Figure 4.58 Schema file (contents model: sequence)

= Remarks =

The name in brackets indicates the element of the schema file for output.

(1) If parent elements are mapped to each other

For conversions between two XML files with the same hierarchical structure, parent elements can be mapped to each other. This section describes the case where parent elements are mapped to each other, as shown below:

Screen 4.27 Mapping information

a) If the XML record unit of the input and output files is set to "1" or "2"

If parent elements are mapped to each other, all data in the input file is processed. In this case, there is no difference between the processing for the XML record unit settings "1" and "2".

Note, however, that if any attribute item exists, the data of the attribute items higher than the element that you have set for XML record unit will not be processed (see Restrictions on XML conversions).

Figure 4.59 Output file

b) If the XML record unit of the input and output files is set to "3"

The elements of the level that is two levels below the root element are considered to be one record, but multiple elements exist in the level just below the root. Therefore, when the second <A> is read, an XML record unit consistency error occurs.

c) If the XML record unit of the input file is set to "Element" and the XML record unit of the output file is set to "Custom"

If the contents models of the elements A and C are set as the starting point of repetition

For the input file, set the element A as the extraction condition in the Add Extraction Condition screen.

For the output file, set the element C as the starting point of repetition.

If parent elements are mapped to each other using these settings, the mapping screen is as follows:

Screen 4.28 Mapping information

In this case, the elements between <A> and </A> are processed as one record for the input file and the element C is processed as one record for the output file. Therefore, the elements between <C> and </C> are output repeatedly for the number of input records.

Figure 4.60 Output file

If the contents models of the elements A and C are set as the starting point of repetition

For the input file, set the element A as the extraction condition in the Add Extraction Condition screen.

For the output file, set the contents model (sequence) of the element C as the starting point of repetition.

If parent elements are mapped to each other using these settings, the mapping screen is as follows:

Screen 4.29 Mapping information

In this case, the elements between <A> and </A> are processed as one record for the input file. The elements D1 and D2 are processed as one record for the output file. Therefore, the elements between <D1> and </D1> and <D2> and </D2> are output repeatedly for the number of input records.

Figure 4.61 Output file

(2) If child elements are mapped to each other

This section describes the case where child elements are mapped to each other, as shown below. The same input file is used here.

Screen 4.30 Mapping information

a) If the XML record unit of the input and output files is set to "1"

The data between <root> and </root> is handled as one record. In this example, the values of the first <B1> and <B2> that have connections in the input data are processed as one record. The second <B1> and <B2> are unmapped items, therefore these are truncated.

Figure 4.62 Output file

b) If the XML record unit of the input and output files are set to "2"

The element of the level just below the root element <root> is handled as one record. In this example, the values of the first <B1> and <B2> that have connections in the data of the first element <A> in the level just below the root element are contained in the output item and processed as the first record. The second <B1> and <B2> are unmapped items, therefore these are truncated. Similarly, the second element <A> is processed as the second record.

Figure 4.63 Output file

c) If the XML record unit of the input and output files is set to "3"

The element of the level that is two levels below the root element <root> is handled as one record.

However, multiple elements exist in the level just below the root. Therefore, when the second <A> is read, an XML record unit consistency error occurs.

d) If the XML record unit of the input file is set to "Element" and the XML record unit of the output file is set to "Custom"

If the elements A and C are set as the starting point of repetition

For the input file, set the element A as the extraction condition in the Add Extraction Condition screen.

For the output file, set the element C as the starting point of repetition.

If child elements are mapped to each other using these settings, the mapping screen is as shown below.

Screen 4.31 Mapping information

In this case, the elements between <A> and </A> are processed as one record for the input file, and the elements between <C> and </C> are processed as one record for the output file. The values of the first <B1> and <B2> that have connections in the input data are contained in the output data and processed as one record. The second <B1> and <B2> are unmapped items, and are therefore truncated. Similarly, the second element <A> is processed as the second record. Similarly, the second element <A> is processed as the second record.

Figure 4.64 Output file

If the contents models of the elements A and C are set as the starting point of repetition

For the input file, set the element A as the extraction condition in the Add Extraction Condition screen.

For the output file, set the contents model (sequence) of the element C as the starting point of repetition.

If child elements are mapped to each other using these settings, the mapping screen is as shown below.

Screen 4.32 Mapping information

In this case, the elements between <A> and </A> are handled as one record for the input file. The elements D1 and D2 are processed as one record for the output file. Therefore, the elements between <D1> and </D1> and <D2> and </D2> are output repeatedly for the number of input records. The values of the first <B1> and <B2> that have connections in the input data are contained in the output data and processed as one record. The second <B1> and <B2> are unmapped items, and are therefore truncated. Similarly, the second element <A> is processed as the second record. Similarly, the second element <A> is processed as the second record.

Figure 4.65 Output file