コード例 #1
0
 private Text2XMLTemplateConverter createConverter(String templateXML) {
   Text2XMLTemplateConverter converter = null;
   try {
     InputStream templateStream = Util.getInputStreamFromResource(templateXML);
     converter =
         CompchemText2XMLTemplateConverter.createTemplateConverter(
             templateStream, "molcas", "log");
   } catch (Exception e) {
     throw new RuntimeException("Cannot make template ", e);
   }
   return converter;
 }
コード例 #2
0
 public static Element getTemplate(String templateResourceName, String baseUri) {
   Element templateElement = null;
   try {
     InputStream is =
         Util.getResourceUsingContextClassLoader(templateResourceName, TemplateTestUtils.class);
     templateElement = new CMLBuilder().build(is, baseUri).getRootElement();
     ClassPathXIncludeResolver.resolveIncludes(templateElement.getDocument(), new CMLBuilder());
   } catch (Exception e) {
     throw new RuntimeException("cannot create template", e);
   }
   return templateElement;
 }