I asked Don about this before when I wrote some validation utilities for the xql files. I think his view was that it was
a little annoying to write correct xml (manifestly true) and that turning all the extant files into valid xml was not a
high priority.
I did validate all the files in 4.6 at one point so a
part from the quoting problem they should
now all be clean (and QD does an ns_quotehtml on the query
text before it feeds it to ns_xml so it is actually parsed
with a standard xml parser rather than something hand rolled).
I think it's easy enough to clean up with a simple script,
maybe it's time to do it. I would also like to do some
stuff to cache the parse across restarts since I would like
the server restart to be quicker and as it stands the qd
parse is an appreciable fraction of the startup time.