本文整理匯總了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));
}
示例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));
}
示例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));
}
示例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));
}
}