Changed ElementTree to lxml and added xml export