# 複数のループエレメントを使って製品データを再構築する

次のシナリオでは、複数のループエレメントを使って、XMLソースファイル*ProductsIn.xml*から製品データを再構築するコンポーネント4つのジョブを作成します。

Talendでサポートされているテクノロジーの詳細は、[Talendコンポーネント](https://help.qlik.com/talend/r/ja-JP/7.3/components/txmlmap)をご覧ください。

![](https://help.qlik.com/talend/ja-JP/components/7.3/Resources/images/txmlmap-multiloop3.png)

以下が4つのコンポーネントです。

* tFileInputXML: ソース製品データを読み取り、それをtXMLMapコンポーネントに渡します。

* tXMLMap: 入力フローを合理化された予想されるストラクチャーに変換します。

* tLogRow: 実行結果をコンソール上に提供します。

* tFileOutputXML: 出力フローをXMLファイルに書き込みます。

ソースXMLファイル*ProductsIn.xml*のコンテンツは以下のとおりです。

```
<?xml version="1.0" encoding="ISO-8859-15"?>
<products category="1" name="laptop">

	<!-- Summary -->
	<summary>
		<company>DELL, HP</company>
		<sales unit="Dollars">12345678910.12345</sales>
		<model>business</model>
	</summary>

	<!-- Loop1 manufacture -->
	<manufacture id="manu_1" date="2012-10-30">
		<name>DELL</name>
	</manufacture>
	<manufacture id="manu_2" date="2012-10-28">
		<name>HP</name>
	</manufacture>

	<!-- Loop2 types -->
	<types model="business1">
		<type>DELL123</type>
		<manufacture_id>manu_1</manufacture_id>
	</types>
	<types model="business2">
		<type>HP123</type>
		<manufacture_id>manu_2</manufacture_id>
	</types>

	<!-- Loop3 sale -->
	<sales>
		<sale unit="Dollars" type="DELL123">
			<quater>1</quater>
			<income>12345</income>
		</sale>
		<sale unit="Dollars" type="HP123">
			<quater>1</quater>
			<income>12345.123</income>
		</sale>
	</sales>
</products>
```

このシナリオの目的は、製品データを再構築して、製造業務に役立つ製品情報のプレゼンテーションを合理化することです。予想される出力データは次のとおりです。ルートエレメントは*manufacturers*に変更され 、販売の情報は*sale*エレメントに統合され、*manufacturer*エレメントは1つのレベルに削減されます。

```
<?xml version="1.0" encoding="ISO-8859-15"?>
<manufacturers category="1" name="laptop">
  <sales unit="Dollars">
    <sale sales_type="DELL123">12345.0</sale>
    <sale sales_type="HP123">12345.123</sale>
  </sales>
  <manufacturer id="manu_1" date="03-04-0036" name="DELL"/>
  <manufacturer id="manu_2" date="04-04-0034" name="HP"/>
  <types>
    <type>DELL123</type>
    <manufacturer_id>manu_1</manufacturer_id>
  </types>
  <types>
    <type>DELL123</type>
    <manufacturer_id>manu_2</manufacturer_id>
  </types>
  <types>
    <type>HP123</type>
    <manufacturer_id>manu_1</manufacturer_id>
  </types>
  <types>
    <type>HP123</type>
    <manufacturer_id>manu_2</manufacturer_id>
  </types>
</manufacturers>
```

### このセクション内

* [コンポーネントを追加してリンク](https://help.qlik.com/talend/ja-JP/components/7.3/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-adding-and-linking-components-standard-component-create)
* [入力フローを設定](https://help.qlik.com/talend/ja-JP/components/7.3/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-configuring-input-flow-standard-component)
* [複数のループを持つtXMLMapを設定](https://help.qlik.com/talend/ja-JP/components/7.3/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-configuring-txmlmap-with-multiple-loops-standard-component)
* [出力フローを設定](https://help.qlik.com/talend/ja-JP/components/7.3/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-configuring-output-flow-standard-component)
* [ジョブを保存して実行](https://help.qlik.com/talend/ja-JP/components/7.3/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-saving-and-executing-job-standard-component-press)

**関連概念**

[tXMLMap](https://help.qlik.com/talend/ja-JP/components/7.3/txmlmap/txmlmap "データを変換し、1つまたは複数のソースから1つまたは複数のデスティネーションにルーティングします。")

**関連情報**

[tFileInputXML](https://help.qlik.com/talend/r/ja-JP/7.3/components/xml-connectors/tfileinputxml)

[tLogRow](https://help.qlik.com/talend/r/ja-JP/7.3/components/logs-and-errors/tlogrow)

[tFileOutputXML](https://help.qlik.com/talend/r/ja-JP/7.3/components/xml-connectors/tfileoutputxml)