move xml reformat function to japi, it is a generic feature