Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert a Delimited File to XML output with an XSD

Hello,
I am new to Talend so apologies for what is probably a very simple job - I just can't seem to figure it out. In my example I have a "complex" delimited file which is as follows:
O|1234|John Smith|Ola Nordmann|Langgt 23|4000 Stavanger|Norway
I|1234|Empire Burlesque|1|10.90|Special Edition
I|1234|Hide your heart|1|9.90

Which is structured as follows:
recordType|orderId|OrderPerson|ShipToName|Address1|Address2|Address3
recordType|orderId|title|quanity|price|notes

Therefore I have created a tFileInputMSDelimited component to process the input file which generates two outputs "row_A_1" (the order) and "row_B_1" (the items).
I want to now convert this file to XML, I have the following XSD:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string" minOccurs="0"/>
<xs:element name="quantity" type="xs:positiveInteger"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>

Therefore I have created a tFileOutputMSXML component and Imported the XSD document as the XML Tree.
How do I get the two different output rows to map to the XML and produce the output?
Any assistance would be greatly appreciated - I'm losing what little hair I have left!!
Cheers
Andy
Labels (3)
13 Replies
Anonymous
Not applicable
Author

Hi Shong,
Where do I find the tHashInput and output components? Can you achieve the same thing with tBufferInput ?
I have searched the Palette and the TOS Components Reference Guide, but nothing shows up.
Is this a feature of another version of the TOS software? I have tried v4.1 and v4.2.2.
thanks Bill
Anonymous
Not applicable
Author

Hi,
I found the tHash* components in the ProjectSettings > Designer > PaletteSettings.
And no, the tBuffer* component didn't provide the same funtionality.
Anonymous
Not applicable
Author

Hi, guys, registered to thank you for the great solution provided in here. You've saved tones of my nerves and time
Anonymous
Not applicable
Author

Has anyone tried this with more complex XSD ? I'm new and trying with latest Talend version to produce Obama care 1094 95 xml files with IRS XSD file.