Created 05-24-2022 08:19 PM
When using the ValidateXML processor with an XSD, how do I capture the reason for the invalid XML so I can troubleshoot instances when the incoming XML is invalid?
Unfortunately I don't have access to a validation tool in the environment where NiFi is running so I need the feedback from the ValidateXML processor.
I appreciate the help.
Created 05-25-2022 08:18 AM
In this case I would suggest you write custom code through ExecuteScript processor to see if you can retrieve such error message. Not sure what else you can do. sorry
Created 05-25-2022 07:06 AM
The ValidateXML processor will write the error to the attribute "validatexml.invalid.error". Check for that attribute when the flowfile is directed to the invalid relationship. Hope that helps
Created 05-25-2022 07:29 AM
All that attribute reports is "Validation failed". I need to know why it failed and at what line number in the flow file it failed. Is it possible to get this information?
Created 05-25-2022 08:18 AM
In this case I would suggest you write custom code through ExecuteScript processor to see if you can retrieve such error message. Not sure what else you can do. sorry
Created 05-25-2022 08:21 AM
OK, thank you for verifying this for me.
Created 07-25-2022 01:25 PM
Hi @ChuckE using NiFi 1.15.2 seems to add the error detail in the "validatexml.invalid.error" attribute.
For example --> "cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 'HotelCode"
This seems to be an issue starting from NiFi 1.16.3, maybe a bug?
You can use NiFi 1.15.2 or custom code as @SAMSAL suggested.
Created 07-27-2022 10:05 AM
That would be nice, but unfortunately v.1.16.x doesn't incorporate this feature and all you get is a generic message: "Validation Failed". In the end I just resorted to downloading the problem flowfile from the queue, and then used xmllint to run a validation, which gave me the answer instantly. But it would be really nice if the developers put the error message back into the "validatexml.invalid.error" attribute in v.1.16.x
Created 08-05-2023 02:47 AM
Hi all
Sorry I'm new to nifi
Anyone found a better way to output the xsd error details?
Not sure how to use script to output the error details, please share some ideas. Thanks
Created on 08-07-2023 08:30 AM - edited 08-07-2023 08:51 AM
Are you referring to validation failures? If this is what you are referring to then the answer is, you can't. If you get failures then you'll need to queue the failures up and validate them manually to see why they failed. I use xmllint. For example:
xmllint --noout --schema my_data_schema.xsd my_data.xml