Added conditional xml processing