Java tutorial
//package com.java2s; /* * Copyright (c) Fiorano Software Pte. Ltd. and affiliates. All rights reserved. http://www.fiorano.com * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ import javax.xml.stream.XMLOutputFactory; public class Main { private static XMLOutputFactory staxOutputFactory = null; /** * This will returns the instance of the STAX XMLOutputFactory and will initialze the properties to the factory. * * @return This will return the instance of STAX XMLOutputFactory. */ public static XMLOutputFactory getStaxOutputFactory() { if (staxOutputFactory == null) { try { // These should be taken from either properties file or from command line arguments. System.setProperty("javax.xml.stream.XMLOutputFactory", "com.ctc.wstx.stax.WstxOutputFactory"); staxOutputFactory = XMLOutputFactory.newInstance(); } catch (Exception ex) { ex.printStackTrace(); } } return staxOutputFactory; } }