code: private CmsResource getResourceForElement(CmsResource xmlPage, String path, int length) {
  
          CmsWrappedResource wrap = new CmsWrappedResource(xmlPage);
          wrap.setRootPath(path);
          int plainId;
          try {
              plainId = OpenCms.getResourceManager().getResourceType(
                  CmsResourceTypePlain.getStaticTypeName()).getTypeId();
          } catch (CmsLoaderException e) {
              // this should really never happen
              plainId = CmsResourceTypePlain.getStaticTypeId();
          }
          wrap.setTypeId(plainId);
          wrap.setFolder(false);
          wrap.setLength(length);
  
          return wrap.getResource();
      }
docs: Returns a virtual resource for an element inside a locale.<p>
  
  A new (virtual) resource is created with the given path and length. The
  new created resource uses the values of the origin resource of the xml page
  where it is possible.<p>
  
  @param xmlPage the xml page resource with the element to create a virtual resource
  @param path the full path to set for the resource
  @param length the length of the element content
  
  @return a new created virtual {@link CmsResource}