Allow query results to be serialized to Xml

Fixes #3538