java.lang.Object
javax.xml.transform.TransformerFactory
- Direct Known Subclasses:
- SAXTransformerFactory
- See Also:
- Top Examples, Source Code,
Templates
, Transformer
public abstract Source getAssociatedStylesheet(Source source,
String media,
String title,
String charset)
throws TransformerConfigurationException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[235]Apply an XSLT transformation to a DOM document tree
By Anonymous on 2003/04/25 14:36:45 Rate
//The code below shows how you could apply an XSLT transformation to a DOM document tree and output the transformed document as XML text to standard output.
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
File xsltfile; // An XSLT file; initialized elsewhere
Document document; // Assume we've already read or created this DOM document
Source xsltSource = new StreamSource ( xsltfile ) ; // Source for transformation
Source source = new DOMSource ( document ) ; // Document to be transformed
Result result = new StreamResult ( System.out ) ; // Where to put result document
// Start off with a factory object
TransformerFactory tf = TransformerFactory.newInstance ( ) ;
// Use the factory to read the XSLT file into a Templates object
Templates transformation = tf.newTemplates ( xsltSource ) ;
// Create a Transformer object from the Templates object
Transformer transformer = transformation.newTransformer ( ) ;
// Finally, perform the transformation
transformer.transform ( source, result ) ;
//getAssociatedStylesheet
public abstract Object getAttribute(String name)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract ErrorListener getErrorListener()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract boolean getFeature(String name)
- See Also:
- NullPointerException,
URI
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract URIResolver getURIResolver()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static TransformerFactory newInstance()
throws TransformerFactoryConfigurationError
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract Templates newTemplates(Source source)
throws TransformerConfigurationException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract Transformer newTransformer()
throws TransformerConfigurationException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract Transformer newTransformer(Source source)
throws TransformerConfigurationException
- See Also:
-
StreamSource
, SAXSource
, DOMSource
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setAttribute(String name,
Object value)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setErrorListener(ErrorListener listener)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setFeature(String name,
boolean value)
throws TransformerConfigurationException
- See Also:
- NullPointerException,
setErrorListener(ErrorListener listener)
, ErrorListener.fatalError(TransformerException exception)
, XMLConstants.FEATURE_SECURE_PROCESSING
, URI
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setURIResolver(URIResolver resolver)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected TransformerFactory()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples