Search code examples
xmltalend

Talend : XML with multiple header => split the file with Talend's job


I've got a problem with a file i received which have multiple header =>

[XML Pic][1]

I would like to create a job with talend to split it in many files or to create one file readable.

I tried many ways but with no success.

The file i receive is output file (*.out), not a XML at the beginning.

Thx for the help ! :)

Edit :

Thx for response :

for exemple : Initial file (*.out file) =>

<?xml version="1.0" encoding="UTF-8"?><Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02"><BkToCstmrDbtCdtNtfctn><GrpHdr><MsgId>AI3069868076</MsgId><CreDtTm>2017-04-03T23:51:23.586</CreDtTm><MsgPgntn><PgNb>1</PgNb><LastPgInd>true</LastPgInd></MsgPgntn></GrpHdr></BkToCstmrDbtCdtNtfctn></Document>
<?xml version="1.0" encoding="UTF-8"?><Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02"><BkToCstmrDbtCdtNtfctn><GrpHdr><MsgId>AI4069973130</MsgId><CreDtTm>2017-04-04T21:09:41.090</CreDtTm><MsgPgntn><PgNb>1</PgNb><LastPgInd>true</LastPgInd></MsgPgntn></GrpHdr></BkToCstmrDbtCdtNtfctn></Document>
<?xml version="1.0" encoding="UTF-8"?><Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02"><BkToCstmrDbtCdtNtfctn><GrpHdr><MsgId>AI4069973134</MsgId><CreDtTm>2017-04-04T21:09:41.090</CreDtTm><MsgPgntn><PgNb>1</PgNb><LastPgInd>true</LastPgInd></MsgPgntn></GrpHdr></BkToCstmrDbtCdtNtfctn></Document>

I would to have

File 1 :

<?xml version="1.0" encoding="UTF-8"?><Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02"><BkToCstmrDbtCdtNtfctn><GrpHdr><MsgId>AI3069868076</MsgId><CreDtTm>2017-04-03T23:51:23.586</CreDtTm><MsgPgntn><PgNb>1</PgNb><LastPgInd>true</LastPgInd></MsgPgntn></GrpHdr></BkToCstmrDbtCdtNtfctn></Document>

File 2 :

<?xml version="1.0" encoding="UTF-8"?><Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02"><BkToCstmrDbtCdtNtfctn><GrpHdr><MsgId>AI4069973130</MsgId><CreDtTm>2017-04-04T21:09:41.090</CreDtTm><MsgPgntn><PgNb>1</PgNb><LastPgInd>true</LastPgInd></MsgPgntn></GrpHdr></BkToCstmrDbtCdtNtfctn></Document>

file 3 :

<?xml version="1.0" encoding="UTF-8"?><Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02"><BkToCstmrDbtCdtNtfctn><GrpHdr><MsgId>AI4069973134</MsgId><CreDtTm>2017-04-04T21:09:41.090</CreDtTm><MsgPgntn><PgNb>1</PgNb><LastPgInd>true</LastPgInd></MsgPgntn></GrpHdr></BkToCstmrDbtCdtNtfctn></Document>

'Cause the inital file is unreadable ! :'(


Solution

  • Check that:

    • tFileInputFullRow schema contains just 1 field called "line" (this the default)
    • tFixedFlowInput schema contains just 1 field called "content" populated with "((String)globalMap.get("row1.line"))"

    Also check that tJavaRow schema looks like:

    You can change field names as you want, but they must be consistent for the job.