BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
XALAN
org.apache.xalan.lib.sql.XConnection Class
javax.xml.transform.sax.TemplatesHandler Class
XALAN Getting Started with XSLTC
The Usage of XALAN
Overview of XALAN - Java
<< WCF, WS, SOAP
XHTML >>

By :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

Extends: javax.xml.transform.sax.SAXTransformerFactory

Members

Signature

Public methods

Source

getAssociatedStylesheet(Source source, java.lang.String media, java.lang.String title, java.lang.String charset)

java.lang.Object

getAttribute(java.lang.String name)

ErrorListener

getErrorListener()

boolean

getFeature(java.lang.String name)

URIResolver

getURIResolver()

Templates

newTemplates(Source source)

TemplatesHandler

newTemplatesHandler()

Transformer

newTransformer()

Transformer

newTransformer(Source source)

TransformerHandler

newTransformerHandler()

TransformerHandler

newTransformerHandler(Source src)

TransformerHandler

newTransformerHandler(Templates templates)

XMLFilter

newXMLFilter(Source src)

XMLFilter

newXMLFilter(Templates templates)

Templates

processFromNode(Node node)

void

setAttribute(java.lang.String name, java.lang.Object value)

void

setErrorListener(ErrorListener listener)

void

setURIResolver(URIResolver resolver)

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.

TransformerFactory tFactory = org.apache.xalan.processor.TransformerFactoryImpl.newInstance();

Example of newTransformer(Source source)

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.

TransformerFactory tFactory = org.apache.xalan.processor.TransformerFactoryImpl.newInstance();

        StreamSource source = new StreamSource(stylesheetURI);

        try{

            Transformer transformer = tFactory.newTransformer(source);

            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.

TransformerFactory tFactory = org.apache.xalan.processor.TransformerFactoryImpl.newInstance();

        StreamSource source = new StreamSource(stylesheetURI);

        try{

            Templates template = tFactory.newTemplates(source);

            Transformer transformer = template.newTransformer();

            StreamSource sourceXML = new StreamSource(xmlfileURI);

            StreamResult result = new StreamResult(outURI);

            transformer.transform(sourceXML, result);

        }catch(Exception e){

            e.printStackTrace();

        }


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En
A Greate Opportunituy as a SQL Deve
An immediate job opportunity as a B

View all Jobs (Add yours)
View all CV (Add yours)



Information Online

swimming pool contractor
chicago web site design
teleconferencing
Web Hosting
go to meeting
Burberry sunglasses
answering service


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP