Ignore xml parse exceptions [SOLVED]

One Star

Ignore xml parse exceptions [SOLVED]

Hi all,
I want to extract datas from xml files generated by differents applications.
To do this, I use a tFileList component to parse a directory containing my xml files and some tFileInputXml component to parse files.
When a xml file isn't correct a SAXParse exception happen and my job is stopped. Is it possible to continue the job, stop the parse of incorrect file but continue parsing others files?
thx all
Community Manager

Re: Ignore xml parse exceptions [SOLVED]

Hello
Is it possible to continue the job, stop the parse of incorrect file but continue parsing others files?

No, it is impossible at the moment. Smiley Sad tFileInputXML don't ignore the error when it meet a exception
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Ignore xml parse exceptions [SOLVED]

Thank you for the response. Smiley Sad
Do you think it's possible to run a tjava component wich delete my corrupted xml file and restart my job?
This tjava component will be start with an "on Error" trigger..
Highlighted
One Star

Re: Ignore xml parse exceptions [SOLVED]

U can first use a tJava to check all xml files and catch the exception, then use talend as usual for the validated files.
One Star

Re: Ignore xml parse exceptions [SOLVED]

Why not! But use a tJava component to check xml files before re-parse some of them isn't very sexy.
One Star

Re: Ignore xml parse exceptions [SOLVED]

I found another solution : (not great but a solution)
I have a main job (job A) which parses all xml files in a directory then remove them (on by one).
When an exception occured in job A because of an incorrect xml file I jump to another job (job B) with an "on error from component" transition.
The job A is stopped by the SAX exception.
The job B move my wrong xml file in another directory (send a mail, etc....) then restart job A.
And finally all xml files are parsed or saved and exception are send by mail.
Thx all... I turn post to solved.

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download