Clean xml function