Methods Summary |
---|
private void | createXSLTCTransformerFactory()
_xsltcFactory = new TransformerFactoryImpl();
_currFactory = _xsltcFactory;
|
private void | createXalanTransformerFactory()
final String xalanMessage =
"com.sun.org.apache.xalan.internal.xsltc.trax.SmartTransformerFactoryImpl "+
"could not create an "+
"com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl.";
// try to create instance of Xalan factory...
try {
Class xalanFactClass = ObjectFactory.findProviderClass(
"com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl",
ObjectFactory.findClassLoader(), true);
_xalanFactory = (SAXTransformerFactory)
xalanFactClass.newInstance();
}
catch (ClassNotFoundException e) {
System.err.println(xalanMessage);
}
catch (InstantiationException e) {
System.err.println(xalanMessage);
}
catch (IllegalAccessException e) {
System.err.println(xalanMessage);
}
_currFactory = _xalanFactory;
|
public javax.xml.transform.Source | getAssociatedStylesheet(javax.xml.transform.Source source, java.lang.String media, java.lang.String title, java.lang.String charset)
if (_currFactory == null) {
createXSLTCTransformerFactory();
}
return _currFactory.getAssociatedStylesheet(source, media,
title, charset);
|
public java.lang.Object | getAttribute(java.lang.String name)
// GTM: NB: 'debug' should change to something more unique...
if ((name.equals("translet-name")) || (name.equals("debug"))) {
if (_xsltcFactory == null) {
createXSLTCTransformerFactory();
}
return _xsltcFactory.getAttribute(name);
}
else {
if (_xalanFactory == null) {
createXalanTransformerFactory();
}
return _xalanFactory.getAttribute(name);
}
|
public javax.xml.transform.ErrorListener | getErrorListener()
return _errorlistener;
|
public boolean | getFeature(java.lang.String name)javax.xml.transform.sax.TransformerFactory implementation.
Look up the value of a feature (to see if it is supported).
This method must be updated as the various methods and features of this
class are implemented.
// All supported features should be listed here
String[] features = {
DOMSource.FEATURE,
DOMResult.FEATURE,
SAXSource.FEATURE,
SAXResult.FEATURE,
StreamSource.FEATURE,
StreamResult.FEATURE
};
// feature name cannot be null
if (name == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
throw new NullPointerException(err.toString());
}
// Inefficient, but it really does not matter in a function like this
for (int i = 0; i < features.length; i++) {
if (name.equals(features[i]))
return true;
}
// secure processing?
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
return featureSecureProcessing;
}
// unknown feature
return false;
|
public javax.xml.transform.URIResolver | getURIResolver()
return _uriresolver;
|
public javax.xml.transform.Templates | newTemplates(javax.xml.transform.Source source)Create a Templates object that from the input stylesheet
Uses the com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
if (_xsltcFactory == null) {
createXSLTCTransformerFactory();
}
if (_errorlistener != null) {
_xsltcFactory.setErrorListener(_errorlistener);
}
if (_uriresolver != null) {
_xsltcFactory.setURIResolver(_uriresolver);
}
_currFactory = _xsltcFactory;
return _currFactory.newTemplates(source);
|
public javax.xml.transform.sax.TemplatesHandler | newTemplatesHandler()Get a TemplatesHandler object that can process SAX ContentHandler
events into a Templates object. Uses the
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
if (_xsltcFactory == null) {
createXSLTCTransformerFactory();
}
if (_errorlistener != null) {
_xsltcFactory.setErrorListener(_errorlistener);
}
if (_uriresolver != null) {
_xsltcFactory.setURIResolver(_uriresolver);
}
return _xsltcFactory.newTemplatesHandler();
|
public javax.xml.transform.Transformer | newTransformer()Create a Transformer object that copies the input document to the
result. Uses the com.sun.org.apache.xalan.internal.processor.TransformerFactory.
if (_xalanFactory == null) {
createXalanTransformerFactory();
}
if (_errorlistener != null) {
_xalanFactory.setErrorListener(_errorlistener);
}
if (_uriresolver != null) {
_xalanFactory.setURIResolver(_uriresolver);
}
_currFactory = _xalanFactory;
return _currFactory.newTransformer();
|
public javax.xml.transform.Transformer | newTransformer(javax.xml.transform.Source source)Create a Transformer object that from the input stylesheet
Uses the com.sun.org.apache.xalan.internal.processor.TransformerFactory.
if (_xalanFactory == null) {
createXalanTransformerFactory();
}
if (_errorlistener != null) {
_xalanFactory.setErrorListener(_errorlistener);
}
if (_uriresolver != null) {
_xalanFactory.setURIResolver(_uriresolver);
}
_currFactory = _xalanFactory;
return _currFactory.newTransformer(source);
|
public javax.xml.transform.sax.TransformerHandler | newTransformerHandler()Get a TransformerHandler object that can process SAX ContentHandler
events based on a copy transformer.
Uses com.sun.org.apache.xalan.internal.processor.TransformerFactory.
if (_xalanFactory == null) {
createXalanTransformerFactory();
}
if (_errorlistener != null) {
_xalanFactory.setErrorListener(_errorlistener);
}
if (_uriresolver != null) {
_xalanFactory.setURIResolver(_uriresolver);
}
return _xalanFactory.newTransformerHandler();
|
public javax.xml.transform.sax.TransformerHandler | newTransformerHandler(javax.xml.transform.Source src)Get a TransformerHandler object that can process SAX ContentHandler
events based on a transformer specified by the stylesheet Source.
Uses com.sun.org.apache.xalan.internal.processor.TransformerFactory.
if (_xalanFactory == null) {
createXalanTransformerFactory();
}
if (_errorlistener != null) {
_xalanFactory.setErrorListener(_errorlistener);
}
if (_uriresolver != null) {
_xalanFactory.setURIResolver(_uriresolver);
}
return _xalanFactory.newTransformerHandler(src);
|
public javax.xml.transform.sax.TransformerHandler | newTransformerHandler(javax.xml.transform.Templates templates)Get a TransformerHandler object that can process SAX ContentHandler
events based on a transformer specified by the stylesheet Source.
Uses com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
if (_xsltcFactory == null) {
createXSLTCTransformerFactory();
}
if (_errorlistener != null) {
_xsltcFactory.setErrorListener(_errorlistener);
}
if (_uriresolver != null) {
_xsltcFactory.setURIResolver(_uriresolver);
}
return _xsltcFactory.newTransformerHandler(templates);
|
public org.xml.sax.XMLFilter | newXMLFilter(javax.xml.transform.Source src)Create an XMLFilter that uses the given source as the
transformation instructions. Uses
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
if (_xsltcFactory == null) {
createXSLTCTransformerFactory();
}
if (_errorlistener != null) {
_xsltcFactory.setErrorListener(_errorlistener);
}
if (_uriresolver != null) {
_xsltcFactory.setURIResolver(_uriresolver);
}
Templates templates = _xsltcFactory.newTemplates(src);
if (templates == null ) return null;
return newXMLFilter(templates);
|
public org.xml.sax.XMLFilter | newXMLFilter(javax.xml.transform.Templates templates)
try {
return new com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter(templates);
}
catch(TransformerConfigurationException e1) {
if (_xsltcFactory == null) {
createXSLTCTransformerFactory();
}
ErrorListener errorListener = _xsltcFactory.getErrorListener();
if(errorListener != null) {
try {
errorListener.fatalError(e1);
return null;
}
catch( TransformerException e2) {
new TransformerConfigurationException(e2);
}
}
throw e1;
}
|
public void | setAttribute(java.lang.String name, java.lang.Object value)
// GTM: NB: 'debug' should change to something more unique...
if ((name.equals("translet-name")) || (name.equals("debug"))) {
if (_xsltcFactory == null) {
createXSLTCTransformerFactory();
}
_xsltcFactory.setAttribute(name, value);
}
else {
if (_xalanFactory == null) {
createXalanTransformerFactory();
}
_xalanFactory.setAttribute(name, value);
}
|
public void | setErrorListener(javax.xml.transform.ErrorListener listener)
_errorlistener = listener;
|
public void | setFeature(java.lang.String name, boolean value)Set a feature for this SmartTransformerFactory and Transformer s
or Template s created by this factory.
Feature names are fully qualified {@link java.net.URI}s.
Implementations may define their own features.
An {@link TransformerConfigurationException} is thrown if this TransformerFactory or the
Transformer s or Template s it creates cannot support the feature.
It is possible for an TransformerFactory to expose a feature value but be unable to change its state.
See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.
// feature name cannot be null
if (name == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME);
throw new NullPointerException(err.toString());
}
// secure processing?
else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
featureSecureProcessing = value;
// all done processing feature
return;
}
else {
// unknown feature
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
throw new TransformerConfigurationException(err.toString());
}
|
public void | setURIResolver(javax.xml.transform.URIResolver resolver)
_uriresolver = resolver;
|