Perform data validation

I have to validate incoming documents of several flavors (iDOC XML, flat file). As I see things so far, I can do this on an XML document level as well as for a record. The in-/output and pipeline ways do not seem appropriate at the moment.

Are there any recommendations as how to do such a validation. Which way are you guys using in what surrounding?