code: public static I_CmsXmlDocument unmarshal(CmsObject cms, String filename, ServletRequest req) throws CmsException {
  
          // add site root to filename
          String rootPath = cms.getRequestContext().addSiteRoot(filename);
  
          // try to get the requested page form the current request attributes
          I_CmsXmlDocument doc = (I_CmsXmlDocument)req.getAttribute(rootPath);
  
          if (doc != null) {
              return doc;
          }
  
          // always use "ignore expiration" filter, date validity must be checked before calling this if required
          CmsFile file = cms.readFile(filename, CmsResourceFilter.IGNORE_EXPIRATION);
  
          if (CmsResourceTypeXmlPage.isXmlPage(file)) {
              // file is of type XML page
              doc = CmsXmlPageFactory.unmarshal(cms, file);
          } else if (CmsResourceTypeXmlContent.isXmlContent(file)) {
              // file is of type XML content
              doc = CmsXmlContentFactory.unmarshal(cms, file);
          } else {
              // sanity check: file type not an A_CmsXmlDocument
              throw new CmsXmlException(Messages.get().container(Messages.ERR_XML_PAGE_FACT_NO_XML_DOCUMENT_1, file));
          }
  
          // store the page that was read as request attribute for future read requests
          req.setAttribute(rootPath, doc);
  
          return doc;
      }
docs: Factory method to unmarshal (read) a XML document instance from
  a filename in the VFS, using the request attributes as cache.<p>
  
  @param cms the current OpenCms user context
  @param filename the filename of the resource to unmarshal
  @param req the current request
  
  @return the unmarshaled XML document, or <code>null</code> if the given resource was not of type {@link I_CmsXmlDocument}
  
  @throws CmsException in something goes wrong