Added facility for defining query in xml