docs: public static String getPreviewContent(
          HttpServletRequest request,
          HttpServletResponse response,
          CmsObject cms,
          CmsResource resource,
          Locale locale) {
  
          try {
              if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
                  CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(
                      cms,
                      cms.getRequestContext().getRootUri());
  
                  CmsFormatterConfiguration formatters = adeConfig.getFormatters(cms, resource);
                  I_CmsFormatterBean formatter = formatters.getPreviewFormatter();
                  if (formatter != null) {
                      CmsObject tempCms = OpenCms.initCmsObject(cms);
                      tempCms.getRequestContext().setLocale(locale);
                      CmsResource formatterResource = tempCms.readResource(formatter.getJspStructureId());
                      request.setAttribute(CmsJspStandardContextBean.ATTRIBUTE_CMS_OBJECT, tempCms);
                      CmsJspStandardContextBean standardContext = CmsJspStandardContextBean.getInstance(request);
                      CmsContainerElementBean element = new CmsContainerElementBean(
                          resource.getStructureId(),
                          formatter.getJspStructureId(),
                          null,
                          false);
                      if ((resource instanceof I_CmsHistoryResource) && (resource instanceof CmsFile)) {
                          element.setHistoryFile((CmsFile)resource);
                      }
                      element.initResource(tempCms);
                      CmsContainerBean containerBean = new CmsContainerBean(
                          "PREVIEW",
                          CmsFormatterBean.PREVIEW_TYPE,
                          null,
                          true,
                          1,
                          Collections.<CmsContainerElementBean> emptyList());
                      containerBean.setWidth(String.valueOf(CmsFormatterBean.PREVIEW_WIDTH));
  
                      standardContext.setContainer(containerBean);
                      standardContext.setElement(element);
                      standardContext.setEdited(true);
                      standardContext.setPage(
                          new CmsContainerPageBean(Collections.<CmsContainerBean> singletonList(containerBean)));
                      String encoding = response.getCharacterEncoding();
                      return (new String(
                          OpenCms.getResourceManager().getLoader(
                              formatterResource).dump(tempCms, formatterResource, null, locale, request, response),
                          encoding)).trim();
                  }
              }
          } catch (Exception e) {
              LOG.warn(e.getLocalizedMessage(), e);
          }
          return null;
      }