Example usage for javax.xml.stream XMLInputFactory newFactory

List of usage examples for javax.xml.stream XMLInputFactory newFactory

Introduction

In this page you can find the example usage for javax.xml.stream XMLInputFactory newFactory.

Prototype

public static XMLInputFactory newFactory(String factoryId, ClassLoader classLoader)
        throws FactoryConfigurationError 

Source Link

Document

Create a new instance of the factory.

Usage

From source file:com.cedarsoft.serialization.test.performance.XmlParserPerformance.java

public void benchJava() {
    runBenchmark(new Runnable() {
        @Override//from   w w w. j a v  a  2 s  . c om
        public void run() {
            try {
                //          XMLInputFactory inputFactory = XMLInputFactory.newInstance( "StAXInputFactory", getClass().getClassLoader() );
                //                        XMLInputFactory inputFactory = XMLInputFactory.newFactory( "com.sun.xml.internal.stream.XMLInputFactoryImpl", getClass().getClassLoader() );
                XMLInputFactory inputFactory = XMLInputFactory.newFactory(
                        "com.sun.xml.internal.stream.XMLInputFactoryImpl", getClass().getClassLoader());

                benchParse(inputFactory, CONTENT_SAMPLE);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }, 4);
}