Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
978
Xalan: The org.apache.xalan.processor.TransformerFactoryImpl Class
Members
inherited from javax.xml.transform.TransformerFactory
Signature
Public methods
public
static TransformerFactory
newInstance()
Overview
This is
an abstract class. This class extends TransformerFactory to provide
SAX-specific factory methods. It provides two types of ContentHandlers, one for
creating Transformers, the other for creating Templates objects.
Before using this method ensure that system property
is set for javax.xml.transform.TransformerFactory. The default setting for this
system property is org.apache.xalan.processor.TransformerFactoryImpl.
Method Overviews
Almost
all methods in this class are important. However I have given example of
methods useful for applications perspective.
Example of newInstance()
Obtain
a new instance of a TransformerFactory. This static method creates a new
factory instance This method uses the following ordered lookup procedure to
determine the TransformerFactory implementation class to load:
Use the
javax.xml.transform.TransformerFactory system property.
Use the
properties file "lib/jaxp.properties" in the JRE directory. This
configuration file is in standard java.util.Properties format and contains the
fully qualified name of the implementation class with the key being the system
property defined above.
Use the
Services API (as detailed in the JAR specification), if available, to determine
the classname. The Services API will look for a classname in the file
META-INF/services/javax.xml.transform.TransformerFactory in jars available to
the runtime.
Platform
default TransformerFactory instance.
Once an
application has obtained a reference to a TransformerFactory it can use the
factory to configure and obtain parser instances.
This
method process the source into a Transformer object. You should ensure that
this object can not be used concurrently in multiple threads. For concurrent
usage, use Templates to create Transformer. Please see newTemplates(Source
source) for usage.
StreamSource sourceXML = new
StreamSource(xmlfileURI);
StreamResult result = new
StreamResult(outURI);
transformer.transform(sourceXML,
result);
}catch(Exception e){
e.printStackTrace();
}
Example of newTemplates(Source source)
This
method creates Templates object from source, which is likely a compiled
representation of the source. This Templates object may then be used
concurrently across multiple threads. Creating a Templates object allows the
TransformerFactory to do detailed performance optimization of transformation
instructions, without penalizing runtime transformation.