private void exportBatch(final XmlSerializer gpx, @NonNull final Collection<String> geocodesOfBatch) throws IOException {
        final Set<Geocache> caches = DataStore.loadCaches(geocodesOfBatch, LoadFlags.LOAD_ALL_DB_ONLY);
        for (final Geocache cache : caches) {
            if (cache == null) {
                continue;
            }

            final boolean isInternal = InternalConnector.getInstance().canHandle(cache.getGeocode());
            final Geopoint coords = cache.getCoords();
            if (coords == null && !isInternal) {
                // Export would be invalid without coordinates.
                continue;
            }
            gpx.startTag(NS_GPX, "wpt");
            gpx.attribute("", "lat", Double.toString(coords == null ? 0 : coords.getLatitude()));
            gpx.attribute("", "lon", Double.toString(coords == null ? 0 : coords.getLongitude()));

            final Date hiddenDate = cache.getHiddenDate();
            if (hiddenDate != null) {
                XmlUtils.simpleText(gpx, NS_GPX, "time", dateFormatZ.format(hiddenDate));
            }

            XmlUtils.multipleTexts(gpx, NS_GPX, "name", cache.getGeocode(), "desc", cache.getName(), "url", cache.getUrl(), "urlname", cache.getName(), "sym", cache.isFound() && Settings.getIncludeFoundStatus() ? "Geocache Found" : "Geocache", "type", "Geocache|" + cache.getType().pattern);

            gpx.startTag(NS_GROUNDSPEAK, "cache");
            gpx.attribute("", "id", cache.getCacheId());
            gpx.attribute("", "available", !cache.isDisabled() ? "True" : "False");
            gpx.attribute("", "archived", cache.isArchived() ? "True" : "False");

            XmlUtils.multipleTexts(gpx, NS_GROUNDSPEAK, "name", cache.getName(), "placed_by", cache.getOwnerDisplayName(), "owner", cache.getOwnerUserId(), "type", cache.getType().pattern, "container", cache.getSize().id);

            writeAttributes(cache);

            XmlUtils.multipleTexts(gpx, NS_GROUNDSPEAK, "difficulty", integerIfPossible(cache.getDifficulty()), "terrain", integerIfPossible(cache.getTerrain()), "country", getCountry(cache), "state", getState(cache));

            gpx.startTag(NS_GROUNDSPEAK, "short_description");
            gpx.attribute("", "html", TextUtils.containsHtml(cache.getShortDescription()) ? "True" : "False");
            gpx.text(cache.getShortDescription());
            gpx.endTag(NS_GROUNDSPEAK, "short_description");

            gpx.startTag(NS_GROUNDSPEAK, "long_description");
            gpx.attribute("", "html", TextUtils.containsHtml(cache.getDescription()) ? "True" : "False");
            gpx.text(cache.getDescription());
            gpx.endTag(NS_GROUNDSPEAK, "long_description");

            XmlUtils.simpleText(gpx, NS_GROUNDSPEAK, "encoded_hints", cache.getHint());

            if (Settings.getIncludeLogs()) {
                writeLogs(cache);
            }
            if (Settings.getIncludeTravelBugs()) {
                writeTravelBugs(cache);
            }

            gpx.endTag(NS_GROUNDSPEAK, "cache");

            writeGsakExtensions(cache);
            writeCGeoExtensions(cache);

            gpx.endTag(NS_GPX, "wpt");

            writeWaypoints(cache);

            countExported++;
            if (progressListener != null) {
                progressListener.publishProgress(countExported);
            }
        }
    }
counter for exported caches, used for progress reporting
main/src/main/java/cgeo/geocaching/export/GpxSerializer.java