|TemplatesHandler||A SAX ContentHandler that may be used to process SAX parse events (parsing transformation instructions) into a Templates object.||code | html|
|TransformerHandler||A TransformerHandler listens for SAX ContentHandler parse events and transforms them to a Result.||code | html|
|SAXTransformerFactory||This class extends TransformerFactory to provide SAX-specific factory methods.||code | html|
Acts as an holder for a transformation Result.
|code | html|
Acts as an holder for SAX-style Source.
Note that XSLT requires namespace support.
|code | html|
This package implements SAX2-specific transformation APIs. It provides classes which allow input from org.xml.sax.ContentHandler events, and also classes that produce org.xml.sax.ContentHandler events. It also provides methods to set the input source as an org.xml.sax.XMLReader , or to use a org.xml.sax.InputSource as the source. It also allows the creation of a org.xml.sax.XMLFilter , which enables transformations to "pull" from other transformations, and lets the transformer to be used polymorphically as an org.xml.sax.XMLReader .
The javax.xml.transform.sax.SAXSource class allows the setting of an org.xml.sax.XMLReader to be used for "pulling" parse events, and an org.xml.sax.InputSource that may be used to specify the SAX source.
The javax.xml.transform.sax.SAXTransformerFactory extends javax.xml.transform.TransformerFactory to provide factory methods for creating javax.xml.transform.sax.TemplatesHandler , javax.xml.transform.sax.TransformerHandler , and org.xml.sax.XMLReader instances.
To obtain a javax.xml.transform.sax.SAXTransformerFactory , the caller must cast the javax.xml.transform.TransformerFactory instance returned from javax.xml.transform.TransformerFactory#newInstance .
The javax.xml.transform.sax.TransformerHandler interface allows a transformation to be created from SAX2 parse events, which is a "push" model rather than the "pull" model that normally occurs for a transformation. Normal parse events are received through the org.xml.sax.ContentHandler interface, lexical events such as startCDATA and endCDATA are received through the org.xml.sax.ext.LexicalHandler interface, and events that signal the start or end of disabling output escaping are received via org.xml.sax.ContentHandler#processingInstruction , with the target parameter being javax.xml.transform.Result#PI_DISABLE_OUTPUT_ESCAPING and javax.xml.transform.Result#PI_ENABLE_OUTPUT_ESCAPING . If parameters, output properties, or other features need to be set on the Transformer handler, a javax.xml.transform.Transformer reference will need to be obtained from javax.xml.transform.sax.TransformerHandler#getTransformer , and the methods invoked from that reference.
The javax.xml.transform.sax.TemplatesHandler interface allows the creation of javax.xml.transform.Templates objects from SAX2 parse events. Once the org.xml.sax.ContentHandler events are complete, the Templates object may be obtained from javax.xml.transform.sax.TemplatesHandler#getTemplates . Note that javax.xml.transform.sax.TemplatesHandler#setSystemId should normally be called in order to establish a base system ID from which relative URLs may be resolved.
The javax.xml.transform.sax.SAXTransformerFactory#newXMLFilter method allows the creation of a org.xml.sax.XMLFilter , which encapsulates the SAX2 notion of a "pull" transformation. The following illustrates several transformations chained together. Each filter points to a parent org.xml.sax.XMLReader , and the final transformation is caused by invoking org.xml.sax.XMLReader#parse on the final reader in the chain.