Java XML Transform newTransformerFactory()

Here you can find the source of newTransformerFactory()

Description

Instantiate a new TransformerFactory.

License

Open Source License

Exception

Parameter Description
Exception an exception

Declaration

public static TransformerFactory newTransformerFactory() throws Exception 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from  ww w.ja v a  2s .  c  o m*/
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

import java.security.AccessController;

import java.security.PrivilegedExceptionAction;

import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;

public class Main {
    /**
     * Instantiate a new TransformerFactory.
     * 
     * @return
     * @throws Exception
     */
    public static TransformerFactory newTransformerFactory() throws Exception {
        return AccessController.doPrivileged(new PrivilegedExceptionAction<TransformerFactory>() {

            public TransformerFactory run() throws Exception {
                try {
                    return TransformerFactory.newInstance();
                } catch (TransformerFactoryConfigurationError error) {
                    throw error.getException();
                }
            }
        });
    }
}

Related

  1. newTransformer()
  2. newTransformer()
  3. newTransformer()
  4. newTransformer(boolean indented)
  5. newTransformer(int indent)
  6. newTransformerFactory()
  7. newTransformerFactory()
  8. newTransformerHandler()
  9. newTransformerHandler()