code: private void changeResourceTypes(Map<I_CmsResourceType, I_CmsResourceType> resTypeMap)
      throws CmsException, UnsupportedEncodingException {
  
          CmsObject cms = getCms();
          CmsObject cloneCms = OpenCms.initCmsObject(cms);
  
          if (isTrue(m_cloneInfo.getApplyChangesEverywhere())) {
              cloneCms.getRequestContext().setSiteRoot("/");
          }
  
          for (Map.Entry<I_CmsResourceType, I_CmsResourceType> mapping : resTypeMap.entrySet()) {
              CmsResourceFilter filter = CmsResourceFilter.requireType(mapping.getKey());
              List<CmsResource> resources = cloneCms.readResources("/", filter);
              String sourceSchemaPath = mapping.getKey().getConfiguration().get("schema");
              String targetSchemaPath = mapping.getValue().getConfiguration().get("schema");
              for (CmsResource res : resources) {
                  if (lockResource(cms, res)) {
                      CmsFile file = cms.readFile(res);
                      if (CmsResourceTypeXmlContent.isXmlContent(file)) {
                          CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
                          xmlContent.setAutoCorrectionEnabled(true);
                          file = xmlContent.correctXmlStructure(getCms());
                      }
                      String encoding = CmsLocaleManager.getResourceEncoding(cms, file);
                      String content = new String(file.getContents(), encoding);
                      content = content.replaceAll(sourceSchemaPath, targetSchemaPath);
                      file.setContents(content.getBytes(encoding));
                      try {
                          cms.writeFile(file);
                      } catch (CmsXmlException e) {
                          LOG.error(e.getMessage(), e);
                      }
                      res.setType(mapping.getValue().getTypeId());
                      cms.writeResource(res);
                  }
              }
          }
      }
docs: Changes the resource types and the schema locations of existing content.<p>
  
  @param resTypeMap a map containing the source types as keys and the target types as values
  
  @throws CmsException if something goes wrong
  @throws UnsupportedEncodingException if the file content could not be read with the determined encoding