question: public AbstractSiteMap parseSiteMap ( String contentType , byte [ ] content , URL url ) throws UnknownFormatException , IOException { MediaType mediaType = MediaType . parse ( contentType ) ; while ( mediaType != null && ! mediaType . equals ( MediaType . OCTET_STREAM ) ) { if ( XML_MEDIA_TYPES . contains ( mediaType ) ) { return processXml ( url , content ) ; } else if ( TEXT_MEDIA_TYPES . contains ( mediaType ) ) { return processText ( url . toString ( ) , content ) ; } else if ( GZ_MEDIA_TYPES . contains ( mediaType ) ) { return processGzip ( url , content ) ; } else { mediaType = MEDIA_TYPE_REGISTRY . getSupertype ( mediaType ) ; return parseSiteMap ( mediaType . toString ( ) , content , url ) ; } } throw new UnknownFormatException ( "Can't parse a sitemap with the MediaType of: " + contentType + " (at: " + url + ")" ) ; }
target:  Parse a sitemap, given the MIME type, the content bytes, and the URL. Note that contentType is assumed to be correct; in general it is more robust to use the method that doesn't take a contentType, but instead detects this using Tika.