Support XML output

TODO: Extract XML result parse code as a class