Home | History | Annotate | Download | only in sax
      1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      2 <html>
      3 <head>
      4 <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
      5 <title>javax.xml.transform.sax</title>
      6 </head>
      7 <body>
      8 <p>This package implements SAX2-specific transformation APIs. It provides
      9   classes which allow input from {@link org.xml.sax.ContentHandler}
     10   events, and also classes that produce org.xml.sax.ContentHandler events. It
     11   also provides methods to set the input source as an
     12   {@link org.xml.sax.XMLReader}, or to use a
     13   {@link org.xml.sax.InputSource} as the source. It also allows the
     14   creation of a {@link org.xml.sax.XMLFilter}, which enables
     15   transformations to "pull" from other transformations, and lets the transformer
     16   to be used polymorphically as an {@link org.xml.sax.XMLReader}.</p>
     17 <p>The {@link javax.xml.transform.sax.SAXSource} class allows the
     18   setting of an {@link org.xml.sax.XMLReader} to be used for "pulling"
     19   parse events, and an {@link org.xml.sax.InputSource} that may be used to
     20   specify the SAX source.</p>
     21 <p>The {@link javax.xml.transform.sax.SAXResult} class allows the
     22   setting of a {@link org.xml.sax.ContentHandler} to be the receiver of
     23   SAX2 events from the transformation. 
     24 <p>The {@link javax.xml.transform.sax.SAXTransformerFactory} extends
     25   {@link javax.xml.transform.TransformerFactory} to provide factory
     26   methods for creating {@link javax.xml.transform.sax.TemplatesHandler},
     27   {@link javax.xml.transform.sax.TransformerHandler}, and
     28   {@link org.xml.sax.XMLReader} instances.</p>
     29 <p>To obtain a {@link javax.xml.transform.sax.SAXTransformerFactory},
     30   the caller must cast the {@link javax.xml.transform.TransformerFactory}
     31   instance returned from
     32   {@link javax.xml.transform.TransformerFactory#newInstance}. 
     33 
     34 <p>The {@link javax.xml.transform.sax.TransformerHandler} interface
     35   allows a transformation to be created from SAX2 parse events, which is a "push"
     36   model rather than the "pull" model that normally occurs for a transformation.
     37   Normal parse events are received through the
     38   {@link org.xml.sax.ContentHandler} interface, lexical events such as
     39   startCDATA and endCDATA are received through the
     40   {@link org.xml.sax.ext.LexicalHandler} interface, and events that signal
     41   the start or end of disabling output escaping are received via
     42   {@link org.xml.sax.ContentHandler#processingInstruction}, with the
     43   target parameter being
     44   {@link javax.xml.transform.Result#PI_DISABLE_OUTPUT_ESCAPING} and
     45   {@link javax.xml.transform.Result#PI_ENABLE_OUTPUT_ESCAPING}. If
     46   parameters, output properties, or other features need to be set on the
     47   Transformer handler, a {@link javax.xml.transform.Transformer} reference
     48   will need to be obtained from
     49   {@link javax.xml.transform.sax.TransformerHandler#getTransformer}, and
     50   the methods invoked from that reference. 
     51 
     52 <p>The {@link javax.xml.transform.sax.TemplatesHandler} interface
     53   allows the creation of {@link javax.xml.transform.Templates} objects
     54   from SAX2 parse events. Once the {@link org.xml.sax.ContentHandler}
     55   events are complete, the Templates object may be obtained from
     56   {@link javax.xml.transform.sax.TemplatesHandler#getTemplates}. Note that
     57   {@link javax.xml.transform.sax.TemplatesHandler#setSystemId} should
     58   normally be called in order to establish a base system ID from which relative
     59   URLs may be resolved. 
     60 <p>The
     61   {@link javax.xml.transform.sax.SAXTransformerFactory#newXMLFilter}
     62   method allows the creation of a {@link org.xml.sax.XMLFilter}, which
     63   encapsulates the SAX2 notion of a "pull" transformation. The following
     64   illustrates several transformations chained together. Each filter points to a
     65   parent {@link org.xml.sax.XMLReader}, and the final transformation is
     66   caused by invoking {@link org.xml.sax.XMLReader#parse} on the final
     67   reader in the chain.</p>
     68 </body>
     69 </html>
     70