当前位置: 首页>>代码示例>>Java>>正文


Java SAXTransformerFactory.newTemplates方法代码示例

本文整理汇总了Java中javax.xml.transform.sax.SAXTransformerFactory.newTemplates方法的典型用法代码示例。如果您正苦于以下问题:Java SAXTransformerFactory.newTemplates方法的具体用法?Java SAXTransformerFactory.newTemplates怎么用?Java SAXTransformerFactory.newTemplates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.transform.sax.SAXTransformerFactory的用法示例。


在下文中一共展示了SAXTransformerFactory.newTemplates方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import javax.xml.transform.sax.SAXTransformerFactory; //导入方法依赖的package包/类
private void load(final Source source, final String localCacheKey, final Map<String, Object> attributes) {
    LOG.debug("{} local cache miss: {}", getClass().getSimpleName(), localCacheKey);

    // XSLT has to be parsed
    final SAXTransformerFactory transformerFactory;
    if (attributes == null || attributes.isEmpty()) {
        transformerFactory = TRAX_FACTORY;
    } else {
        transformerFactory = createNewSAXTransformerFactory();
        attributes.entrySet().forEach(attribute -> {
            transformerFactory.setAttribute(attribute.getKey(), attribute.getValue());
        });
    }

    try {
        this.templates = transformerFactory.newTemplates(source);
    } catch (TransformerConfigurationException e) {
        throw new SetupException("Impossible to read XSLT from '" + source + "', see nested exception", e);
    }
}
 
开发者ID:apache,项目名称:syncope,代码行数:21,代码来源:XSLTTransformer.java

示例2: create

import javax.xml.transform.sax.SAXTransformerFactory; //导入方法依赖的package包/类
@SuppressWarnings("resource")
private Templates create(final String inputXsltScript, final SAXTransformerFactory transformerFactory)
    throws TransformerConfigurationException,
    IOException {
  if (inputXsltScript == null) {
    return null;
  }
  try (final InputStream stream = this.connector.execute(inputXsltScript)) {
    if (logger.isLoggable(ILevel.DEBUG)) {
      logger.log(ILevel.DEBUG, inputXsltScript);
    }
    return transformerFactory.newTemplates(new StreamSource(new NoneClosingInputStream(stream)));
  }
}
 
开发者ID:AndreasWBartels,项目名称:libraries,代码行数:15,代码来源:RegistableConvertingXmlPersisterFactory.java

示例3: getTemplates

import javax.xml.transform.sax.SAXTransformerFactory; //导入方法依赖的package包/类
public static Templates getTemplates(Source source, String clazz, Map attributes, Configuration configuration, ErrorListener errorListener, URIResolver uriResolver)
            throws TransformerConfigurationException {
        final SAXTransformerFactory factory = (attributes != null) ? getFactory(clazz, attributes, configuration) : getFactory(clazz);
        factory.setErrorListener(errorListener);
        factory.setURIResolver(uriResolver);

        final Templates templates = factory.newTemplates(source);
        // These should only be used during stylesheet compilation. It is dangerous to keep them around when the
        // Templates object is cached especially the URI Resolver which may reference PipelineContext objects.
//        factory.setErrorListener(null);// This causes issues with Xalan
        factory.setURIResolver(null);

        return templates;
    }
 
开发者ID:evlist,项目名称:orbeon-forms,代码行数:15,代码来源:TransformerUtils.java

示例4: loadTemplates

import javax.xml.transform.sax.SAXTransformerFactory; //导入方法依赖的package包/类
Templates loadTemplates(String resourceName) throws BuildException {
	try {
		// XXX nb: no xsltc option this way
		//TransformerFactory tf = XSLTProcessor.newTransformerFactory(); 
		SAXTransformerFactory tf = (SAXTransformerFactory)TransformerFactory.newInstance();
		
		return tf.newTemplates(new StreamSource(new BufferedInputStream(
			getResource(resourceName))));
	}
	catch(TransformerConfigurationException e) {
		throw new BuildException("Problem loading template "
			+ resourceName + ": " + e.getMessage(), e, getLocation());
	}
}
 
开发者ID:OpenCCG,项目名称:openccg,代码行数:15,代码来源:CCGBankExtract.java


注:本文中的javax.xml.transform.sax.SAXTransformerFactory.newTemplates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。