Our website uses the Apache Velocity template language. Our Content Management System already checks any generated XML documents for well-formedness. We\'ve been asked to
To catch Velocity syntax errors, your approach is probably the best.
However, it will ignore invalid macro arguments and non-existent references. In Velocity 1.6 there is a strict mode that you can set which will throw an exception for bad macro parameters (e.g. the wrong number) or for bad references (e.g. $abc.badMethod() ). This assumes you are populating the context of the templates used in your testing tool the same as when the templates are used in production.