Gerben,

Maybe this is of some use. The Lua code in the file checks the xml and returns info when something is wrong.

I am using it for example in my takenotes module as:
<notes file="events/na-30416155-5-48v.xml" checkxml="yes"/>

And this is a sketch of how it is embedded in that module:

% Prerun an xml check.
\doifinset{\xmlatt{#1}{checkxml}}{yes,on,true}%
{\xmlcommand{#1}{.}{xmlcommon:checkxml}}

% Execute this code if no error was found.
etc.

dr. Hans van der Meer