本文整理匯總了Java中javax.xml.stream.XMLOutputFactory.newFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java XMLOutputFactory.newFactory方法的具體用法?Java XMLOutputFactory.newFactory怎麽用?Java XMLOutputFactory.newFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.stream.XMLOutputFactory
的用法示例。
在下文中一共展示了XMLOutputFactory.newFactory方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testDefaultInstance
import javax.xml.stream.XMLOutputFactory; //導入方法依賴的package包/類
/**
* Test if newDefaultFactory() method returns an instance
* of the expected factory.
* @throws Exception If any errors occur.
*/
@Test
public void testDefaultInstance() throws Exception {
XMLOutputFactory of1 = XMLOutputFactory.newDefaultFactory();
XMLOutputFactory of2 = XMLOutputFactory.newFactory();
assertNotSame(of1, of2, "same instance returned:");
assertSame(of1.getClass(), of2.getClass(),
"unexpected class mismatch for newDefaultFactory():");
assertEquals(of1.getClass().getName(), DEFAULT_IMPL_CLASS);
}
示例2: testNewFactory
import javax.xml.stream.XMLOutputFactory; //導入方法依賴的package包/類
@Test(dataProvider = "parameters")
public void testNewFactory(String factoryId, ClassLoader classLoader) {
setSystemProperty(XMLOUTPUT_FACTORY_ID, XMLOUTPUT_FACTORY_CLASSNAME);
try {
XMLOutputFactory xif = XMLOutputFactory.newFactory(factoryId, classLoader);
assertNotNull(xif);
} finally {
clearSystemProperty(XMLOUTPUT_FACTORY_ID);
}
}
示例3: testNewFactoryNeg
import javax.xml.stream.XMLOutputFactory; //導入方法依賴的package包/類
@Test(expectedExceptions = NullPointerException.class, dataProvider = "new-instance-neg", dataProviderClass = JAXPDataProvider.class)
public void testNewFactoryNeg(String factoryId, ClassLoader classLoader) {
XMLOutputFactory.newFactory(factoryId, classLoader);
}