當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。