docs: protected void rewriteContent(CmsFile file, Collection<CmsRelation> relations) throws CmsException {
  
          LOG.info("Rewriting in-content links for " + file.getRootPath());
          CmsPair<String, String> contentAndEncoding = decode(file);
  
          String content = "";
  
          if (OpenCms.getResourceManager().getResourceType(file) instanceof CmsResourceTypeXmlContent) {
              CmsXmlContent contentXml = CmsXmlContentFactory.unmarshal(m_cms, file);
              try {
                  contentXml.validateXmlStructure(new CmsXmlEntityResolver(m_cms));
              } catch (CmsException e) {
                  LOG.info("XML content was corrected automatically for resource " + file.getRootPath());
                  contentXml.setAutoCorrectionEnabled(true);
                  contentXml.correctXmlStructure(m_cms);
                  try {
                      content = new String(contentXml.marshal(), contentAndEncoding.getSecond());
                  } catch (UnsupportedEncodingException e1) {
                      //
                  }
              }
          }
  
          if (content.isEmpty()) {
              content = contentAndEncoding.getFirst();
          }
          String encodingForSave = contentAndEncoding.getSecond();
          String newContent = rewriteContentString(content);
          byte[] newContentBytes;
          try {
              newContentBytes = newContent.getBytes(encodingForSave);
          } catch (UnsupportedEncodingException e) {
              newContentBytes = newContent.getBytes();
          }
          file.setContents(newContentBytes);
          m_cms.writeFile(file);
  
      }