1 package com.genimen.djeneric.web.util; 2 3 import javax.xml.transform.TransformerFactory ; 4 import javax.xml.transform.TransformerFactoryConfigurationError ; 5 import javax.xml.transform.URIResolver ; 6 7 public class DjenericTransformerFactory 8 { 9 private static String _factoryClassName = null; 10 private static URIResolver _uriResolver = new DjenericXslUriResolver(); 11 12 public static String getFactoryClassName() 13 { 14 return _factoryClassName; 15 } 16 17 public static void setFactoryClassName(String factoryClassName) 18 { 19 _factoryClassName = factoryClassName; 20 } 21 22 public static TransformerFactory newInstance() 23 { 24 try 25 { 26 TransformerFactory tFactory; 27 if (_factoryClassName == null) 28 { 29 tFactory = TransformerFactory.newInstance(); 30 } 31 else 32 { 33 Class clazz = Thread.currentThread().getContextClassLoader().loadClass(_factoryClassName); 34 tFactory = (TransformerFactory ) clazz.newInstance(); 35 } 36 tFactory.setURIResolver(_uriResolver); 37 return tFactory; 38 } 39 catch (Exception x) 40 { 41 throw new TransformerFactoryConfigurationError (x); 42 } 43 } 44 45 } | Popular Tags |