Validate XML message coming from DB query in PDI

I am retrieving XML messages that are stored in a database via query. Before sending them to a “Get Data from XML” step, I want to make sure that the XMLs are well formatted.

There is a step on Job level that performs that check but in order to use it I would have to write every message to a file first which I do not want.

Is there another way to validate an XML within the transformation? I was looking at using the Modified JavaScript value step but all the examples I found on the web to do that seem to refer to a JS version higher than 3.0 (which is currently used by PDI).

Is there any working example for PDI that truly works?