當前位置: 首頁>>代碼示例>>Java>>正文


Java XMLOutputFactory.newFactory方法代碼示例

本文整理匯總了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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:XMLOutputFactoryNewInstanceTest.java

示例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);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:XMLOutputFactoryNewInstanceTest.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:XMLOutputFactoryNewInstanceTest.java


注:本文中的javax.xml.stream.XMLOutputFactory.newFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。