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

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

![ジョブの説明。](https://help.qlik.com/talend/ja-JP/components/8.0/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 manufacturer -->
	<manufacturer id="manu_1" date="2012-10-30">
		<name>DELL</name>
	</manufacturer>
	<manufacturer id="manu_2" date="2012-10-28">
		<name>HP</name>
	</manufacturer>

	<!-- Loop2 types -->
	<types model="business1">
		<type>DELL123</type>
		<manufacturer_id>manu_1</manufacturer_id>
	</types>
	<types model="business2">
		<type>HP123</type>
		<manufacturer_id>manu_2</manufacturer_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つのレベルに削減されます。

ProductsOutput.xmlというソースXMLファイルの期待されるコンテンツは次のとおりです。

```
<?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/8.0/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-adding-and-linking-components-standard-component-create)
* [入力フローを設定](https://help.qlik.com/talend/ja-JP/components/8.0/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-configuring-input-flow-standard-component)
* [複数のループを持つtXMLMapを設定](https://help.qlik.com/talend/ja-JP/components/8.0/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-configuring-txmlmap-with-multiple-loops-standard-component)
* [出力フローを設定](https://help.qlik.com/talend/ja-JP/components/8.0/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-configuring-output-flow-standard-component)
* [ジョブを保存して実行](https://help.qlik.com/talend/ja-JP/components/8.0/txmlmap/txmlmap-tfileinputxml-tlogrow-tfileoutputxml-saving-and-executing-job-standard-component-press)

**関連資料**

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

**関連情報**

* [tFileInputXML](https://help.qlik.com/talend/r/ja-JP/8.0/components/xml-connectors/tfileinputxml)
* [tLogRow](https://help.qlik.com/talend/r/ja-JP/8.0/components/logs-and-errors/tlogrow)
* [tFileOutputXML](https://help.qlik.com/talend/r/ja-JP/8.0/components/xml-connectors/tfileoutputxml)