code: public static List<CmsDialogElement> computeElements(CmsObject cms, String xmlPageUri, Locale locale) {
  
          CmsXmlPage page = null;
          try {
              // read the xmlpage file
              CmsFile pageFile = cms.readFile(xmlPageUri, CmsResourceFilter.IGNORE_EXPIRATION);
              page = CmsXmlPageFactory.unmarshal(cms, pageFile);
          } catch (CmsException e) {
              LOG.warn(Messages.get().getBundle().key(Messages.LOG_READ_XMLPAGE_FAILED_1, xmlPageUri), e);
              // xmlpage will be null, only "template-elements" property on template will be checked
          }
          return computeElements(cms, page, xmlPageUri, locale);
      }
docs: Creates a list of possible elements of a template from the template property "template-elements"
  and the elements available in the provided resource file.<p>
  
  @param cms the CmsObject
  @param xmlPageUri the resource to read the elements from
  @param locale the current element locale
  @return the list of elements in a String array with element name, nice name (if present) and mandatory flag