Mapping and transforming XML data
The following scenario creates a three-component Job that maps and transforms data from an
XML source file Customer.xml, and generates an XML output flow which
could be reused for various purposes, such as for an ESB request, in the future based on the
XML tree structure of the file Customer_State.xml.
These three components are:
-
tFileInputXML: provides the input data to
tXMLMap. -
tXMLMap: maps and transforms the received XML
data flows into one single XML data flow. -
tLogRow: displays the output data.
The content of the XML file Customer.xml is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
<?xml version="1.0" encoding="ISO-8859-15"?> <Customers> <Customer RegisterTime="2001-01-17 06:26:40.000"> <Name> <id>1</id> <CustomerName>Griffith Paving and Sealcoatin</CustomerName> </Name> <Address> <CustomerAddress>talend@apres91</CustomerAddress> <idState>2</idState> </Address> <Revenue> <Sum1>67852</Sum1> </Revenue> </Customer> <Customer RegisterTime="2002-06-07 09:40:00.000"> <Name> <id>2</id> <CustomerName>Bill's Dive Shop</CustomerName> </Name> <Address> <CustomerAddress>511 Maple Ave. Apt. 1B</CustomerAddress> <idState>3</idState> </Address> <Revenue> <Sum1>88792</Sum1> </Revenue> </Customer> <Customer RegisterTime="1987-02-23 17:33:20.000"> <Name> <id>3</id> <CustomerName>Glenn Oaks Office Supplies</CustomerName> </Name> <Address> <CustomerAddress>1859 Green Bay Rd.</CustomerAddress> <idState>2</idState> </Address> <Revenue> <Sum1>1225.</Sum1> </Revenue> </Customer> <Customer RegisterTime="1992-04-28 23:26:40.000"> <Name> <id>4</id> <CustomerName>DBN Bank</CustomerName> </Name> <Address> <CustomerAddress>456 Grossman Ln.</CustomerAddress> <idState>3</idState> </Address> <Revenue> <Sum1>64493</Sum1> </Revenue> </Customer> </Customers> |
The content of the XML file Customer_State.xml is as
follows:
follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?xml version="1.0" encoding="ISO-8859-15"?> <customers> <customer id="1"> <CustomerName>Griffith Paving and Sealcoatin</CustomerName> <CustomerAddress>talend@apres91</CustomerAddress> <idState>2</idState> </customer> <customer id="2"> <CustomerName>Bill's Dive Shop</CustomerName> <CustomerAddress>511 Maple Ave. Apt. 1B</CustomerAddress> <idState>3</idState> </customer> </customers> |
Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Login
0 Comments