code: public static CmsXmlPage unmarshal(CmsObject cms, CmsResource resource, ServletRequest req) throws CmsException {
  
          String rootPath = resource.getRootPath();
  
          if (!CmsResourceTypeXmlPage.isXmlPage(resource)) {
              // sanity check: resource must be of type XML page
              throw new CmsXmlException(
                  Messages.get().container(Messages.ERR_XML_PAGE_FACT_NO_XMLPAGE_TYPE_1, cms.getSitePath(resource)));
          }
  
          // try to get the requested page form the current request attributes
          CmsXmlPage page = (CmsXmlPage)req.getAttribute(rootPath);
  
          if (page == null) {
              // unmarshal XML structure from the file content
              page = unmarshal(cms, cms.readFile(resource));
              // store the page that was read as request attribute for future read requests
              req.setAttribute(rootPath, page);
          }
  
          return page;
      }
docs: Factory method to unmarshal (read) a XML page instance from
  a resource, using the request attributes as cache.<p>
  
  @param cms the current OpenCms user context
  @param resource the resource to unmarshal
  @param req the current request
  
  @return the unmarshaled XML page, or null if the given resource was not of type {@link CmsResourceTypeXmlPage}
  
  @throws CmsException in something goes wrong