SAXTransformerFactory


SAXTransformerFactory javax.xml.transform.sax

Java 1.4

This class extends transformerFactory to define additional factory methods that are useful when working with documents that are represented as sequences of SAX events. Pass the FEATURE constant to the getFeature( ) method of your TRansformerFactory object to determine whether the newTemplatesHandler( ) and newtransformerHandler( ) methods are supported and whether it is safe to cast your transformerFactory object to a SAXTransformerFactory . Use the FEATURE_XMLFILTER constant with getFeature( ) to determine if the newXMLFilter( ) methods are also supported.

newTemplatesHandler( ) returns a TemplatesHandler object that you can use as an org.xml.sax.ContentHandler object to receive SAX events generated by a SAX parser and transform those events into a Templates object.

The newtransformerHandler( ) methods are similar: they return a transformerHandler object that can receive SAX events and representing a source document and transform them into a Result document. The no-argument version of newTRansformerHandler( ) creates a TRansformerHandler that simply modifies the form of the document without applying a stylesheet to its content. The other two versions of newtransformerHandler( ) use a stylesheet specified either as a Source or Templates object.

The newXMLFilter( ) methods, if supported, return an org.xml.sax.XMLFilter object that can acts as both a sink and a source of SAX events and filters those events by applying the transformation instructions specified by the Templates or Source objects.

Figure 20-13. javax.xml.transform.sax.SAXTransformerFactory

 public abstract class  SAXTransformerFactory  extends javax.xml.transform.TransformerFactory {  // Protected Constructors  protected  SAXTransformerFactory  ( );  // Public Constants  public static final String  FEATURE  ;  =  "http://javax.xml.transform.sax.SAXTransformerFactory/feature"       public static final String  FEATURE_XMLFILTER  ;  ="http://javax.xml.transform.sax.SAXTransformerFactory/feature/xmlfilter"   // Public Instance Methods  public abstract TemplatesHandler  newTemplatesHandler  ( )          throws javax.xml.transform.TransformerConfigurationException;        public abstract TransformerHandler  newTransformerHandler  ( )          throws javax.xml.transform.TransformerConfigurationException;        public abstract TransformerHandler  newTransformerHandler  (javax.xml.transform.Source  src  )          throws javax.xml.transform.TransformerConfigurationException;        public abstract TransformerHandler  newTransformerHandler  (javax.xml.transform.Templates  templates  )          throws javax.xml.transform.TransformerConfigurationException;        public abstract org.xml.sax.XMLFilter  newXMLFilter  (javax.xml.transform.Source  src  )          throws javax.xml.transform.TransformerConfigurationException;        public abstract org.xml.sax.XMLFilter  newXMLFilter  (javax.xml.transform.Templates  templates  )          throws javax.xml.transform.TransformerConfigurationException;   } 



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net