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

tXMLMap

Version
7.3
Language
日本語
Product
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
ジョブデザインと開発 > サードパーティーシステム > 変換処理コンポーネント > tXMLMap
データガバナンス > サードパーティーシステム > 変換処理コンポーネント > tXMLMap
データクオリティとプレパレーション > サードパーティーシステム > 変換処理コンポーネント > tXMLMap
Last publication date
2024-02-22

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

Talendでサポートされているテクノロジーの詳細は、Talendコンポーネントをご覧ください。

以下が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>