Validate XML file with XSD

One Star

Validate XML file with XSD

Hi,
My job is validating an XML file with an XSD as following : tXSDValidator--->tMap--->tFileOutputDelimited. It works fine.
Unfortunately, when the XML file is invalid, the tFileOutputDelimited contains no information about the problem I have in my XML file but only that the XML file is invalid ("file aaa.xml is invalid!"). Even if this information is important for me to log, I need to know more. As the size of my XML file will increase soon, I want to use my job to give me information about what is wrong and thus spend as less time as possible searching what's wrong with my XML file.
In the properties of the tXSDValidator I've seen that, when I check the "Print to console" checkbox, I have the information I need in the console. Unfortunately I don't know how to retrieve it. So I see 2 options :
- either there is a way to read the message printed in the console and to write it into a file,
- or there is an option in the tXSDValidator that allows to know what is wrong in the XML file.
Is one of this option possible ? Any other idea how to resolve my problem ?
Thanks in advance
One Star

Re: Validate XML file with XSD

Have you tried ((String)globalMap.get("tXSDValidator_1_ERROR_MESSAGE")) ?
I think you can use an "If" link based on the value of tXSDValidator_1_VALID and then write tXSDValidator_1_ERROR_MESSAGE in your file / console.
Ektor

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog