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


Java Transformer.clearParameters方法代码示例

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


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

示例1: clear10

import javax.xml.transform.Transformer; //导入方法依赖的package包/类
/**
 * Obtains transformer's parameter whose initiated with a dom source with
 * the a name that wasn't set before. Null is expected.
 * @throws Exception If any errors occur.
 */
@Test
public void clear10() throws Exception {
    TransformerFactory tfactory = TransformerFactory.newInstance();

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document document = db.parse(new File(XSL_FILE));
    DOMSource domSource = new DOMSource((Node)document);

    Transformer transformer = tfactory.newTransformer(domSource);
    transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
    transformer.clearParameters();
    assertNull(transformer.getParameter(LONG_PARAM_NAME));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:TfClearParamTest.java

示例2: clear02

import javax.xml.transform.Transformer; //导入方法依赖的package包/类
/**
 * Obtains transformer's parameter with the a name that wasn't set before.
 * Null is expected.
 * @throws TransformerConfigurationException If for some reason the
 *         TransformerHandler can not be created.
 */
@Test
public void clear02() throws TransformerConfigurationException {
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
    transformer.clearParameters();
    assertNull(transformer.getParameter(LONG_PARAM_NAME));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:TfClearParamTest.java

示例3: clear06

import javax.xml.transform.Transformer; //导入方法依赖的package包/类
/**
 * Obtains transformer's parameter whose initiated with a stream source with
 * the a name that wasn't set before. Null is expected.
 * @throws TransformerConfigurationException If for some reason the
 *         TransformerHandler can not be created.
 */
@Test
public void clear06() throws TransformerConfigurationException {
    Transformer transformer = TransformerFactory.newInstance().
            newTransformer(new StreamSource(new File(XSL_FILE)));
    transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
    transformer.clearParameters();
    assertNull(transformer.getParameter(LONG_PARAM_NAME));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:TfClearParamTest.java

示例4: clear08

import javax.xml.transform.Transformer; //导入方法依赖的package包/类
/**
 * Obtains transformer's parameter whose initiated with a sax source with
 * the a name that wasn't set before. Null is expected.
 * @throws Exception If any errors occur.
 */
@Test
public void clear08() throws Exception {
    try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
        SAXSource saxSource = new SAXSource();
        saxSource.setInputSource(new InputSource(fis));

        Transformer transformer = TransformerFactory.newInstance().newTransformer(saxSource);
        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
        transformer.clearParameters();
        assertNull(transformer.getParameter(LONG_PARAM_NAME));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:TfClearParamTest.java


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