com.icl.saxon
Class Controller

java.lang.Object
  |
  +--com.icl.saxon.Controller
All Implemented Interfaces:
Transformer, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public class Controller
extends java.lang.Object
implements Transformer

Controller processes an XML file, calling registered node handlers when appropriate to process its elements, character content, and attributes.


Field Summary
static int DO_NOT_RECOVER
           
static int RECOVER_SILENTLY
           
static int RECOVER_WITH_WARNINGS
           
 
Constructor Summary
protected Controller()
          Create a Controller and initialise variables.
 
Method Summary
 void addTraceListener(TraceListener trace)
          Adds the specified trace listener to receive trace events from this instance.
 void applyImports(Context c, Mode mode, int min, int max)
          Apply a template imported from the stylesheet containing the current template
 void applyTemplates(Context c, Expression select, Mode mode, ParameterSet parameters)
          ApplyTemplates to process selected nodes using the handlers registered for a particular mode.
 Bindery getBindery()
          Get the current bindery
 org.xml.sax.ContentHandler getContentHandler()
          Return the content handler to which transformation output will be directed.
 OutputDetails getCurrentOutputDetails()
          Get the current output details
 DecimalFormatManager getDecimalFormatManager()
           
 java.util.Hashtable getDocumentPool()
          Get the document pool.
 Sequencer getDocumentSequencer()
          Get the sequencer to be used for numbering documents
 org.xml.sax.DTDHandler getDTDHandler()
          Return the current DTD handler.
 org.xml.sax.EntityResolver getEntityResolver()
          Return the current entity resolver.
 org.xml.sax.ErrorHandler getErrorHandler()
          Return the current error handler.
 boolean getFeature(java.lang.String name)
          Look up the value of a feature.
 OutputDetails getInitialOutputDetails()
          Get the initial output details
 org.xml.sax.ContentHandler getInputContentHandler()
          Get a SAX2 ContentHandler to which the source document can be fed as a stream of SAX events.
 org.xml.sax.ext.DeclHandler getInputDeclHandler()
          Get a SAX2 DeclHandler for the input.
 org.xml.sax.ext.LexicalHandler getInputLexicalHandler()
          Get a SAX2 LexicalHandler for the input.
 KeyManager getKeyManager()
          Get the KeyManager
 Emitter getMessageEmitter()
          Get the Emitter used for xsl:message output
 NamePool getNamePool()
          Get the name pool in use
 Sequencer getNodeSequencer()
          Get the sequencer to be used for numbering nodes
 OutputManager getOutputManager()
          Get the OutputManager in use.
 Outputter getOutputter()
          Get the current outputter
 org.xml.sax.XMLReader getParent()
          Get the parent reader.
 java.lang.Object getProperty(java.lang.String name)
          Look up the value of a property.
 int getRecoveryPolicy()
          Get the policy for handling recoverable errors
 RuleManager getRuleManager()
           
 Stripper getStripper()
          Get the stripper to use for source documents loaded using the document() function
 TraceListener getTraceListener()
           
 int getTreeModel()
          Get the tree model in use
 URIResolver getURIResolver()
          Get the current URI resolver
 java.lang.Object getUserData(NodeInfo node, java.lang.String name)
          Get the named user data property for the node
 org.xml.sax.XMLReader getXMLReader()
          Get the XML parser used for the source tree.
 boolean isLineNumbering()
          Determine whether line numbering is enabled
 boolean isTracing()
           
 Builder makeBuilder()
          Make a builder for the selected tree model
 Context makeContext(NodeInfo node)
          Create a new context with a given node as the current node and the only node in the current node list.
 Stripper makeStripper()
          Make a stripper to use with this Controller
 void parse(org.xml.sax.InputSource input)
          "Parse an XML document." In the context of a Transformer, this means perform a transformation.
 void parse(java.lang.String systemId)
          Parse (i.e.
 void removeTraceListener(TraceListener trace)
          Removes the specified trace listener so that the next invocation of the render method will not send trace events to the listener.
 void reportRecoverableError(java.lang.String message, NodeInfo location)
          Report a recoverable error
 Outputter resetOutputDetails()
          Close the current output destination, and revert to the previous output destination.
 void resetParameters()
          Reset the parameters to a null list.
 void run(DocumentInfo doc)
          Process a Document.
 void setBindery(Bindery b)
          Set a Bindery to use.
 void setContentHandler(org.xml.sax.ContentHandler handler)
          Allow an application to register a content event handler to process the result of the transformation.
 void setDecimalFormatManager(DecimalFormatManager manager)
           
 void setDiagnosticName(java.lang.String name)
          Set a diagnostic name for this transformation (accessible through toString())
 void setDocumentSequencer(Sequencer seq)
          Set the sequencer to be used for numbering documents
 void setDTDHandler(org.xml.sax.DTDHandler handler)
          Allow an application to register a DTD event handler.
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
          Allow an application to register an entity resolver.
 void setErrorHandler(org.xml.sax.ErrorHandler handler)
          Allow an application to register an error event handler.
 void setFeature(java.lang.String name, boolean value)
          Set the state of a feature.
 void setLineNumbering(boolean onOrOff)
          Set line numbering (of the source document) on or off
 void setMessageEmitter(Emitter emitter)
          Set the Emitter to be used for xsl:message output
 void setNamePool(NamePool pool)
          Set the name pool to be used
 void setNewOutputDetails(OutputDetails details)
          Start a new output destination during the transformation
 void setNodeSequencer(Sequencer seq)
          Set the sequencer to be used for numbering nodes
 void setOutputDetails(OutputDetails details)
          Set the initial output details.
 void setOutputFormat(OutputFormat oformat)
          Set the output properties for the transformation.
 void setParameter(java.lang.String localname, java.lang.String namespace, java.lang.Object value)
          Set a parameter for the templates.
 void setParams(ParameterSet params)
          Set parameters supplied externally (typically, on the command line).
 void setParent(org.xml.sax.XMLReader parent)
          Set the parent reader.
 void setPreparedStyleSheet(PreparedStyleSheet sheet)
          Associate this Controller with a compiled stylesheet
 void setProperty(java.lang.String name, java.lang.Object value)
          Set the value of a property.
 void setRecoveryPolicy(int policy)
          Set the policy for handling recoverable errors
 void setRuleManager(RuleManager r)
           
 void setSourceParser(org.xml.sax.Parser parser)
          Deprecated. in Saxon 5.2: use setXMLReader() instead, to supply a SAX2 parser.
 void setTiming(boolean on)
           
 void setTraceListener(TraceListener trace)
           
 void setTreeModel(int model)
          Set the tree data model to use
 void setURIResolver(URIResolver resolver)
          Set an object that will be used to resolve URIs used in document(), etc.
 void setUserData(NodeInfo node, java.lang.String name, java.lang.Object data)
          Set a user data property for a node.
 void setXMLReader(org.xml.sax.XMLReader reader)
          Set an XML parser for the source tree.
 java.lang.String toString()
           
 void transform(org.xml.sax.InputSource in)
          Process the source tree to SAX parse events.
 void transform(org.xml.sax.InputSource xmlSource, Result outputTarget)
          Process the source tree to the output result.
 void transformDocument(DocumentInfo sourceDoc)
          Render a source XML document supplied as a tree.
 void transformNode(org.w3c.dom.Node node)
          Process the source node to to SAX parse events, if the processor supports the "http://xml.org/trax/features/dom/input" feature.
 void transformNode(org.w3c.dom.Node node, Result outputTarget)
          Process the source node to the output result, if the processor supports the "http://xml.org/trax/features/dom/input" feature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RECOVER_SILENTLY

public static final int RECOVER_SILENTLY

RECOVER_WITH_WARNINGS

public static final int RECOVER_WITH_WARNINGS

DO_NOT_RECOVER

public static final int DO_NOT_RECOVER
Constructor Detail

Controller

protected Controller()
Create a Controller and initialise variables. Constructor is protected, the Controller should be created using newTransformer() in the PreparedStyleSheet class.
Method Detail

setDiagnosticName

public void setDiagnosticName(java.lang.String name)
Set a diagnostic name for this transformation (accessible through toString())

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

run

public void run(DocumentInfo doc)
         throws org.xml.sax.SAXException
Process a Document.

This method is intended for use when performing a pure Java transformation, without a stylesheet. Where there is an XSLT stylesheet, use transformDocument() or transform() instead: those methods set up information from the stylesheet before calling run().

The process starts by calling the registered node handler to process the document root object. Note that the same document can be processed any number of times, typically with different node handlers for each pass. The Document will typically have been built using com.icl.saxon.tree.Builder.


applyTemplates

public void applyTemplates(Context c,
                           Expression select,
                           Mode mode,
                           ParameterSet parameters)
                    throws org.xml.sax.SAXException
ApplyTemplates to process selected nodes using the handlers registered for a particular mode.
Parameters:
select - A node-set expression that determines which descendant elements are selected. Note: if the nodes are to be sorted, the select Expression will take care of this.
mode - A String that names the processing mode. It should match the mode defined when the element handler was registered using setHandler with a mode parameter. Set this parameter to null to invoke the default mode.
parameters - A ParameterSet containing the parameters to the handler/template being invoked. Specify null if there are no parameters.

applyImports

public void applyImports(Context c,
                         Mode mode,
                         int min,
                         int max)
                  throws org.xml.sax.SAXException
Apply a template imported from the stylesheet containing the current template

getOutputManager

public OutputManager getOutputManager()
Get the OutputManager in use.

getOutputter

public Outputter getOutputter()
Get the current outputter

getInitialOutputDetails

public OutputDetails getInitialOutputDetails()
Get the initial output details

setOutputDetails

public void setOutputDetails(OutputDetails details)
                      throws org.xml.sax.SAXException
Set the initial output details. This method should not be used once the transformation is underway: use setNewOutputDetails() instead.

setNewOutputDetails

public void setNewOutputDetails(OutputDetails details)
                         throws org.xml.sax.SAXException
Start a new output destination during the transformation

getCurrentOutputDetails

public OutputDetails getCurrentOutputDetails()
Get the current output details

resetOutputDetails

public Outputter resetOutputDetails()
                             throws org.xml.sax.SAXException
Close the current output destination, and revert to the previous output destination.
Returns:
the new current outputter

setMessageEmitter

public void setMessageEmitter(Emitter emitter)
Set the Emitter to be used for xsl:message output

getMessageEmitter

public Emitter getMessageEmitter()
Get the Emitter used for xsl:message output

setRecoveryPolicy

public void setRecoveryPolicy(int policy)
Set the policy for handling recoverable errors

getRecoveryPolicy

public int getRecoveryPolicy()
Get the policy for handling recoverable errors

reportRecoverableError

public void reportRecoverableError(java.lang.String message,
                                   NodeInfo location)
                            throws org.xml.sax.SAXException
Report a recoverable error

getDocumentPool

public java.util.Hashtable getDocumentPool()
Get the document pool. This is used only for source documents, not for stylesheet modules

getStripper

public Stripper getStripper()
Get the stripper to use for source documents loaded using the document() function

setLineNumbering

public void setLineNumbering(boolean onOrOff)
Set line numbering (of the source document) on or off

isLineNumbering

public boolean isLineNumbering()
Determine whether line numbering is enabled

makeContext

public Context makeContext(NodeInfo node)
Create a new context with a given node as the current node and the only node in the current node list. Note we use Controller as a factory class for Context objects because we expect to introduce subclasses of Context for different Controllers in future.

setBindery

public void setBindery(Bindery b)
Set a Bindery to use. If none is supplied, the Controller creates one itself

getBindery

public Bindery getBindery()
Get the current bindery

getURIResolver

public URIResolver getURIResolver()
Get the current URI resolver

getKeyManager

public KeyManager getKeyManager()
Get the KeyManager

setNamePool

public void setNamePool(NamePool pool)
Set the name pool to be used

getNamePool

public NamePool getNamePool()
Get the name pool in use

setDocumentSequencer

public void setDocumentSequencer(Sequencer seq)
Set the sequencer to be used for numbering documents

setNodeSequencer

public void setNodeSequencer(Sequencer seq)
Set the sequencer to be used for numbering nodes

getDocumentSequencer

public Sequencer getDocumentSequencer()
Get the sequencer to be used for numbering documents

getNodeSequencer

public Sequencer getNodeSequencer()
Get the sequencer to be used for numbering nodes

setTreeModel

public void setTreeModel(int model)
Set the tree data model to use

getTreeModel

public int getTreeModel()
Get the tree model in use

makeBuilder

public Builder makeBuilder()
Make a builder for the selected tree model

makeStripper

public Stripper makeStripper()
Make a stripper to use with this Controller

setDecimalFormatManager

public void setDecimalFormatManager(DecimalFormatManager manager)

getDecimalFormatManager

public DecimalFormatManager getDecimalFormatManager()

setRuleManager

public void setRuleManager(RuleManager r)

getRuleManager

public RuleManager getRuleManager()

setTiming

public void setTiming(boolean on)

setTraceListener

public void setTraceListener(TraceListener trace)

getTraceListener

public TraceListener getTraceListener()

isTracing

public final boolean isTracing()

setPreparedStyleSheet

public void setPreparedStyleSheet(PreparedStyleSheet sheet)
Associate this Controller with a compiled stylesheet

setSourceParser

public void setSourceParser(org.xml.sax.Parser parser)
Deprecated. in Saxon 5.2: use setXMLReader() instead, to supply a SAX2 parser.

Set the SAX-compliant parser to use for the source document. If no parser is specified, the parser is obtained from the ParserManager.properties file.
Parameters:
parser - The XML parser to use. This must be an instance of a class that implements the org.xml.sax.Parser interface.

setParams

public void setParams(ParameterSet params)
Set parameters supplied externally (typically, on the command line).
Parameters:
params - A ParameterSet containing the (name, value) pairs.

transformDocument

public void transformDocument(DocumentInfo sourceDoc)
                       throws org.xml.sax.SAXException
Render a source XML document supplied as a tree.
A new output destination should be created for each source document, by using setOutputDetails().
Parameters:
document - A DocumentInfo object identifying the root of the source document tree. (Note, this must currently be a DocumentImpl object)

addTraceListener

public void addTraceListener(TraceListener trace)
Adds the specified trace listener to receive trace events from this instance. Must be called before the invocation of the render method.
Parameters:
trace - the trace listener.

removeTraceListener

public void removeTraceListener(TraceListener trace)
Removes the specified trace listener so that the next invocation of the render method will not send trace events to the listener.
Parameters:
trace - the trace listener.

getUserData

public java.lang.Object getUserData(NodeInfo node,
                                    java.lang.String name)
Get the named user data property for the node
Parameters:
the - name of the user data property to return
Returns:
The value of the named user data property. Returns null if no property of that name has been set using setUserData() for this NodeInfo object.

setUserData

public void setUserData(NodeInfo node,
                        java.lang.String name,
                        java.lang.Object data)
Set a user data property for a node.
Parameters:
name - The name of the user data property to be set. Any existing user data property of the same name will be overwritten.
userData - an object to be saved with this element, which can be retrieved later using getUserData().

transform

public void transform(org.xml.sax.InputSource in)
               throws TransformException
Process the source tree to SAX parse events.
Specified by:
transform in interface Transformer
Parameters:
xmlSource - The input for the source tree.

transform

public void transform(org.xml.sax.InputSource xmlSource,
                      Result outputTarget)
               throws TransformException
Process the source tree to the output result.
Specified by:
transform in interface Transformer
Parameters:
xmlSource - The input for the source tree.
outputTarget - The output destination.

transformNode

public void transformNode(org.w3c.dom.Node node,
                          Result outputTarget)
                   throws TransformException
Process the source node to the output result, if the processor supports the "http://xml.org/trax/features/dom/input" feature.
Specified by:
transformNode in interface Transformer
Parameters:
node - The input source node, which can be any valid DOM node. ** Currently in Saxon it must be a Document node. **
outputTarget - The output source target.

transformNode

public void transformNode(org.w3c.dom.Node node)
                   throws TransformException
Process the source node to to SAX parse events, if the processor supports the "http://xml.org/trax/features/dom/input" feature.
Specified by:
transformNode in interface Transformer
Parameters:
node - The input source node, which can be any valid DOM node. ** In SAXON, it must currently be a Document node **

getInputContentHandler

public org.xml.sax.ContentHandler getInputContentHandler()
Get a SAX2 ContentHandler to which the source document can be fed as a stream of SAX events.
Specified by:
getInputContentHandler in interface Transformer
Returns:
A valid ContentHandler, which should never be null, as long as getFeature("http://xml.org/trax/features/sax/input") returns true.

getInputDeclHandler

public org.xml.sax.ext.DeclHandler getInputDeclHandler()
Get a SAX2 DeclHandler for the input.
Specified by:
getInputDeclHandler in interface Transformer
Returns:
A valid DeclHandler, which should never be null, as long as getFeature("http://xml.org/trax/features/sax/input") returns true.

getInputLexicalHandler

public org.xml.sax.ext.LexicalHandler getInputLexicalHandler()
Get a SAX2 LexicalHandler for the input.
Specified by:
getInputLexicalHandler in interface Transformer
Returns:
A valid LexicalHandler, which should never be null, as long as getFeature("http://xml.org/trax/features/sax/input") returns true.

setOutputFormat

public void setOutputFormat(OutputFormat oformat)
Set the output properties for the transformation. These properties will override properties set in the templates with xsl:output.
Specified by:
setOutputFormat in interface Transformer
See Also:
OutputFormat

setParameter

public void setParameter(java.lang.String localname,
                         java.lang.String namespace,
                         java.lang.Object value)
Set a parameter for the templates.
Specified by:
setParameter in interface Transformer
Parameters:
name - The name of the parameter.
namespace - The namespace of the parameter.

resetParameters

public void resetParameters()
Reset the parameters to a null list.
Specified by:
resetParameters in interface Transformer

setURIResolver

public void setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in document(), etc.
Specified by:
setURIResolver in interface Transformer
Parameters:
resolver - An object that implements the URIResolver interface, or null.

setXMLReader

public void setXMLReader(org.xml.sax.XMLReader reader)
Set an XML parser for the source tree. Note that if Transformer.setXMLReader is not called, the parser set with Processor.setXMLReader will be used.
Specified by:
setXMLReader in interface Transformer

getXMLReader

public org.xml.sax.XMLReader getXMLReader()
Get the XML parser used for the source tree. Note that if Transformer.setXMLReader is not called, the parser set with Processor.setXMLReader will be used.
Specified by:
getXMLReader in interface Transformer

setParent

public void setParent(org.xml.sax.XMLReader parent)
Set the parent reader.

This method allows the application to link the filter to a parent reader (which may be another filter). The argument may not be null.

Specified by:
setParent in interface org.xml.sax.XMLFilter
Parameters:
parent - The parent reader (the supplier of SAX events).

getParent

public org.xml.sax.XMLReader getParent()
Get the parent reader.

This method allows the application to query the parent reader (which may be another filter). It is generally a bad idea to perform any operations on the parent reader directly: they should all pass through this filter.

Specified by:
getParent in interface org.xml.sax.XMLFilter
Returns:
The parent filter, or null if none has been set.

getFeature

public boolean getFeature(java.lang.String name)
                   throws org.xml.sax.SAXNotRecognizedException,
                          org.xml.sax.SAXNotSupportedException
Look up the value of a feature.

The feature name is any fully-qualified URI. It is possible for an XMLReader to recognize a feature name but to be unable to return its value; this is especially true in the case of an adapter for a SAX1 Parser, which has no way of knowing whether the underlying parser is performing validation or expanding external entities.

All XMLReaders are required to recognize the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names.

Specified by:
getFeature in interface org.xml.sax.XMLReader
Parameters:
name - The feature name, which is a fully-qualified URI.
Returns:
The current state of the feature (true or false).
Throws:
org.xml.sax.SAXNotRecognizedException - When the XMLReader does not recognize the feature name.
org.xml.sax.SAXNotSupportedException - When the XMLReader recognizes the feature name but cannot determine its value at this time.
See Also:
setFeature(java.lang.String, boolean)

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws org.xml.sax.SAXNotRecognizedException,
                       org.xml.sax.SAXNotSupportedException
Set the state of a feature.

The feature name is any fully-qualified URI. It is possible for an XMLReader to recognize a feature name but to be unable to set its value; this is especially true in the case of an adapter for a SAX1 Parser, which has no way of affecting whether the underlying parser is validating, for example.

All XMLReaders are required to support setting http://xml.org/sax/features/namespaces to true and http://xml.org/sax/features/namespace-prefixes to false.

Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.

Specified by:
setFeature in interface org.xml.sax.XMLReader
Parameters:
name - The feature name, which is a fully-qualified URI.
state - The requested state of the feature (true or false).
Throws:
org.xml.sax.SAXNotRecognizedException - When the XMLReader does not recognize the feature name.
org.xml.sax.SAXNotSupportedException - When the XMLReader recognizes the feature name but cannot set the requested value.
See Also:
getFeature(java.lang.String)

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws org.xml.sax.SAXNotRecognizedException,
                                    org.xml.sax.SAXNotSupportedException
Look up the value of a property.

The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to return its state; this is especially true in the case of an adapter for a SAX1 Parser.

XMLReaders are not required to recognize any specific property names, though an initial core set is documented for SAX2.

Some property values may be available only in specific contexts, such as before, during, or after a parse.

Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.

Specified by:
getProperty in interface org.xml.sax.XMLReader
Parameters:
name - The property name, which is a fully-qualified URI.
Returns:
The current value of the property.
Throws:
org.xml.sax.SAXNotRecognizedException - When the XMLReader does not recognize the property name.
org.xml.sax.SAXNotSupportedException - When the XMLReader recognizes the property name but cannot determine its value at this time.
See Also:
setProperty(java.lang.String, java.lang.Object)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws org.xml.sax.SAXNotRecognizedException,
                        org.xml.sax.SAXNotSupportedException
Set the value of a property.

The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to set its value; this is especially true in the case of an adapter for a SAX1 Parser.

XMLReaders are not required to recognize setting any specific property names, though a core set is provided with SAX2.

Some property values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.

This method is also the standard mechanism for setting extended handlers.

Specified by:
setProperty in interface org.xml.sax.XMLReader
Parameters:
name - The property name, which is a fully-qualified URI.
state - The requested value for the property.
Throws:
org.xml.sax.SAXNotRecognizedException - When the XMLReader does not recognize the property name.
org.xml.sax.SAXNotSupportedException - When the XMLReader recognizes the property name but cannot set the requested value.

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
Allow an application to register an entity resolver.

If the application does not register an entity resolver, the XMLReader will perform its own default resolution.

Applications may register a new or different resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.

Specified by:
setEntityResolver in interface org.xml.sax.XMLReader
Parameters:
resolver - The entity resolver.
Throws:
java.lang.NullPointerException - If the resolver argument is null.
See Also:
getEntityResolver()

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
Return the current entity resolver.
Specified by:
getEntityResolver in interface org.xml.sax.XMLReader
Returns:
The current entity resolver, or null if none has been registered.
See Also:
setEntityResolver(org.xml.sax.EntityResolver)

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler handler)
Allow an application to register a DTD event handler.

If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Specified by:
setDTDHandler in interface org.xml.sax.XMLReader
Parameters:
handler - The DTD handler.
Throws:
java.lang.NullPointerException - If the handler argument is null.
See Also:
getDTDHandler()

getDTDHandler

public org.xml.sax.DTDHandler getDTDHandler()
Return the current DTD handler.
Specified by:
getDTDHandler in interface org.xml.sax.XMLReader
Returns:
The current DTD handler, or null if none has been registered.
See Also:
setDTDHandler(org.xml.sax.DTDHandler)

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler handler)
Allow an application to register a content event handler to process the result of the transformation.

In SAX2, Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately. ** Saxon does not permit this **

Specified by:
setContentHandler in interface org.xml.sax.XMLReader
Parameters:
handler - The content handler.
Throws:
java.lang.NullPointerException - If the handler argument is null.
See Also:
getContentHandler()

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
Return the content handler to which transformation output will be directed.
Specified by:
getContentHandler in interface org.xml.sax.XMLReader
Returns:
The current content handler, or null if none has been registered.
See Also:
setContentHandler(org.xml.sax.ContentHandler)

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler handler)
Allow an application to register an error event handler.

If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Specified by:
setErrorHandler in interface org.xml.sax.XMLReader
Parameters:
handler - The error handler.
Throws:
java.lang.NullPointerException - If the handler argument is null.
See Also:
getErrorHandler()

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
Return the current error handler.
Specified by:
getErrorHandler in interface org.xml.sax.XMLReader
Returns:
The current error handler, or null if none has been registered.
See Also:
setErrorHandler(org.xml.sax.ErrorHandler)

parse

public void parse(org.xml.sax.InputSource input)
           throws java.io.IOException,
                  org.xml.sax.SAXException
"Parse an XML document." In the context of a Transformer, this means perform a transformation. The method is equivalent to transform().
Specified by:
parse in interface org.xml.sax.XMLReader
Parameters:
source - The input source (the XML document to be transformed)
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
java.io.IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See Also:
InputSource, parse(java.lang.String), setEntityResolver(org.xml.sax.EntityResolver), setDTDHandler(org.xml.sax.DTDHandler), setContentHandler(org.xml.sax.ContentHandler), setErrorHandler(org.xml.sax.ErrorHandler)

parse

public void parse(java.lang.String systemId)
           throws java.io.IOException,
                  org.xml.sax.SAXException
Parse (i.e. transform) an XML document from a system identifier (URI).

This method is a shortcut for the common case of reading a document from a system identifier. It is the exact equivalent of the following:

 parse(new InputSource(systemId));
 

If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser.

Specified by:
parse in interface org.xml.sax.XMLReader
Parameters:
systemId - The system identifier (URI).
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
java.io.IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See Also:
parse(org.xml.sax.InputSource)