code: public static CmsXmlSitemapGenerator prepareSitemapGenerator(CmsResource seoFileRes, CmsXmlSeoConfiguration config)
      throws CmsException {
  
          if (config.getMode().equals(CmsXmlSeoConfiguration.MODE_XML_SITEMAP)) {
              String baseFolderRootPath = CmsFileUtil.removeTrailingSeparator(
                  CmsResource.getParentFolder(seoFileRes.getRootPath()));
              CmsXmlSitemapGenerator xmlSitemapGenerator = createSitemapGenerator(
                  config.getSitemapGeneratorClassName(),
                  baseFolderRootPath);
              xmlSitemapGenerator.setComputeContainerPageDates(config.shouldComputeContainerPageModificationDates());
              CmsPathIncludeExcludeSet inexcludeSet = xmlSitemapGenerator.getIncludeExcludeSet();
              for (String include : config.getIncludes()) {
                  inexcludeSet.addInclude(include);
              }
              for (String exclude : config.getExcludes()) {
                  inexcludeSet.addExclude(exclude);
              }
              xmlSitemapGenerator.setServerUrl(config.getServerUrl());
              return xmlSitemapGenerator;
          }
          return null;
      }
docs: Constructs an XML sitemap generator given an XML sitemap configuration file.<p>
  
  @param seoFileRes the sitemap XML file
  @param config the parsed configuration
  
  @return the sitemap generator, or null if the given configuration is not an XML sitemap configuration
  
  @throws CmsException if something goes wrong