本文整理汇总了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));
}
}