handle xml both ends