move query to xml