Add minimal XML export functionality to avoid undef thrown by xmerl

Yet another PR to address #669