@Override
    public MediaType detect(ZipFile zip, TikaInputStream tis) throws IOException {
        Enumeration<ZipArchiveEntry> entries = zip.getEntries();
        int kmlCount = 0;
        while (entries.hasMoreElements()) {
            ZipArchiveEntry entry = entries.nextElement();
            String name = entry.getName();
            if (!entry.isDirectory() && name.indexOf('/') == -1 && name.indexOf('\\') == -1) {
                if (name.toLowerCase(Locale.ROOT).endsWith(".kml")) {
                    kmlCount++;
                }
                if (kmlCount > 1) {
                    return null;
                }
            }
        }
        if (kmlCount == 1) {
            return KMZ;
        }
        return null;
    }
This looks for a single file with a name ending in ".kml" at the root level of the zip file.
<p>
As of Tika 3.2.1, we allow other files at the root level.
<p>
We could make this more robust by requiring xml root detection on the *.kml file.
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-zip-commons/src/main/java/org/apache/tika/detect/zip/KMZDetector.java