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
5 REPLIES
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..
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.