java.lang.Object
javax.xml.transform.Transformer
- See Also:
- Top Examples, Source Code,
TransformerFactory.newTransformer
public abstract void clearParameters()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[523]XSLT Example
By Anonymous on 2003/11/17 09:50:12 Rate
//XSLT Example
TransformerFactory transFactory =
TransformerFactory.newInstance ( ) ;
StreamResult destination = new
StreamResult ( System.out ) ;
try {
StreamSource xslSource =
new StreamSource ( new File ( xslFileName ) ) ;
Transformer transformer = new Transformer ( xslSource ) ;
// 'source' is a DOMSource
transformer.transform ( source, destination ) ;
} catch ( TransformerConfigurationException tce ) {
// Handle exception
} catch ( TransformerException te ) {
// Handle Exception
}
//clearParameters
public abstract ErrorListener getErrorListener()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract Properties getOutputProperties()
- See Also:
-
OutputKeys
, setOutputProperties
, setOutputProperty(java.lang.String, java.lang.String)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract String getOutputProperty(String name)
throws IllegalArgumentException
- See Also:
OutputKeys
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract Object getParameter(String name)
- 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 void reset()
- See Also:
Object.equals(Object obj)
, ErrorListener
, URIResolver
, Templates.newTransformer()
, TransformerFactory.newTransformer(Source source)
, TransformerFactory.newTransformer()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setErrorListener(ErrorListener listener)
throws IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setOutputProperties(Properties oformat)
- See Also:
-
OutputKeys
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setOutputProperty(String name,
String value)
throws IllegalArgumentException
- See Also:
OutputKeys
, setOutputProperties(java.util.Properties)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setParameter(String name,
Object value)
- See Also:
- NullPointerException
- 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
public abstract void transform(Source xmlSource,
Result outputTarget)
throws TransformerException
- See Also:
-
DocumentBuilder.newDocument()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1254]XSLT transformation
By Anonymous on 2005/01/15 18:37:59 Rate
public String transform ( String xslFilePath, String xmlFilePath ) {
Writer outWriter = new StringWriter ( ) ;
// Create xsl source, input source, and result streams.
StreamSource xslSource = new StreamSource ( xslFilePath ) ;
StreamSource xmlSource = new StreamSource ( xmlFilePath ) ;
StreamResult outResult = new StreamResult ( outWriter ) ;
try {
// Get transformer factory and transformer.
TransformerFactory factory = TransformerFactory.newInstance ( ) ;
Transformer transformer = factory.newTransformer ( xslSource ) ;
// Do transformation.
transformer.transform ( xmlSource, outResult ) ;
} catch ( Exception ex ) {
System.err.println ( ex ) ;
}
return outResult.getWriter ( ) .toString ( ) ;
}
protected Transformer()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples