Update cachexml to only replace file if it validates.