|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.icl.saxon.Controller
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 |
public static final int RECOVER_SILENTLY
public static final int RECOVER_WITH_WARNINGS
public static final int DO_NOT_RECOVER
Constructor Detail |
protected Controller()
Method Detail |
public void setDiagnosticName(java.lang.String name)
public java.lang.String toString()
toString
in class java.lang.Object
public void run(DocumentInfo doc) throws org.xml.sax.SAXException
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.
public void applyTemplates(Context c, Expression select, Mode mode, ParameterSet parameters) throws org.xml.sax.SAXException
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.public void applyImports(Context c, Mode mode, int min, int max) throws org.xml.sax.SAXException
public OutputManager getOutputManager()
public Outputter getOutputter()
public OutputDetails getInitialOutputDetails()
public void setOutputDetails(OutputDetails details) throws org.xml.sax.SAXException
public void setNewOutputDetails(OutputDetails details) throws org.xml.sax.SAXException
public OutputDetails getCurrentOutputDetails()
public Outputter resetOutputDetails() throws org.xml.sax.SAXException
public void setMessageEmitter(Emitter emitter)
public Emitter getMessageEmitter()
public void setRecoveryPolicy(int policy)
public int getRecoveryPolicy()
public void reportRecoverableError(java.lang.String message, NodeInfo location) throws org.xml.sax.SAXException
public java.util.Hashtable getDocumentPool()
public Stripper getStripper()
public void setLineNumbering(boolean onOrOff)
public boolean isLineNumbering()
public Context makeContext(NodeInfo node)
public void setBindery(Bindery b)
public Bindery getBindery()
public URIResolver getURIResolver()
public KeyManager getKeyManager()
public void setNamePool(NamePool pool)
public NamePool getNamePool()
public void setDocumentSequencer(Sequencer seq)
public void setNodeSequencer(Sequencer seq)
public Sequencer getDocumentSequencer()
public Sequencer getNodeSequencer()
public void setTreeModel(int model)
public int getTreeModel()
public Builder makeBuilder()
public Stripper makeStripper()
public void setDecimalFormatManager(DecimalFormatManager manager)
public DecimalFormatManager getDecimalFormatManager()
public void setRuleManager(RuleManager r)
public RuleManager getRuleManager()
public void setTiming(boolean on)
public void setTraceListener(TraceListener trace)
public TraceListener getTraceListener()
public final boolean isTracing()
public void setPreparedStyleSheet(PreparedStyleSheet sheet)
public void setSourceParser(org.xml.sax.Parser parser)
parser
- The XML parser to use. This must be an instance of a class
that implements the org.xml.sax.Parser interface.public void setParams(ParameterSet params)
params
- A ParameterSet containing the (name, value) pairs.public void transformDocument(DocumentInfo sourceDoc) throws org.xml.sax.SAXException
document
- A DocumentInfo object identifying the root of the source document tree.
(Note, this must currently be a DocumentImpl object)public void addTraceListener(TraceListener trace)
trace
- the trace listener.public void removeTraceListener(TraceListener trace)
trace
- the trace listener.public java.lang.Object getUserData(NodeInfo node, java.lang.String name)
the
- name of the user data property to returnpublic void setUserData(NodeInfo node, java.lang.String name, java.lang.Object data)
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().public void transform(org.xml.sax.InputSource in) throws TransformException
transform
in interface Transformer
xmlSource
- The input for the source tree.public void transform(org.xml.sax.InputSource xmlSource, Result outputTarget) throws TransformException
transform
in interface Transformer
xmlSource
- The input for the source tree.outputTarget
- The output destination.public void transformNode(org.w3c.dom.Node node, Result outputTarget) throws TransformException
transformNode
in interface Transformer
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.public void transformNode(org.w3c.dom.Node node) throws TransformException
transformNode
in interface Transformer
node
- The input source node, which can be any valid DOM node. ** In SAXON,
it must currently be a Document node **public org.xml.sax.ContentHandler getInputContentHandler()
getInputContentHandler
in interface Transformer
public org.xml.sax.ext.DeclHandler getInputDeclHandler()
getInputDeclHandler
in interface Transformer
public org.xml.sax.ext.LexicalHandler getInputLexicalHandler()
getInputLexicalHandler
in interface Transformer
public void setOutputFormat(OutputFormat oformat)
setOutputFormat
in interface Transformer
OutputFormat
public void setParameter(java.lang.String localname, java.lang.String namespace, java.lang.Object value)
setParameter
in interface Transformer
name
- The name of the parameter.namespace
- The namespace of the parameter.public void resetParameters()
resetParameters
in interface Transformer
public void setURIResolver(URIResolver resolver)
setURIResolver
in interface Transformer
resolver
- An object that implements the URIResolver interface,
or null.public void setXMLReader(org.xml.sax.XMLReader reader)
setXMLReader
in interface Transformer
public org.xml.sax.XMLReader getXMLReader()
getXMLReader
in interface Transformer
public void setParent(org.xml.sax.XMLReader parent)
This method allows the application to link the filter to a parent reader (which may be another filter). The argument may not be null.
setParent
in interface org.xml.sax.XMLFilter
parent
- The parent reader (the supplier of SAX events).public org.xml.sax.XMLReader getParent()
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.
getParent
in interface org.xml.sax.XMLFilter
public boolean getFeature(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
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.
getFeature
in interface org.xml.sax.XMLReader
name
- The feature name, which is a fully-qualified URI.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.setFeature(java.lang.String, boolean)
public void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
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.
setFeature
in interface org.xml.sax.XMLReader
name
- The feature name, which is a fully-qualified URI.state
- The requested state of the feature (true or false).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.getFeature(java.lang.String)
public java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
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.
getProperty
in interface org.xml.sax.XMLReader
name
- The property name, which is a fully-qualified URI.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.setProperty(java.lang.String, java.lang.Object)
public void setProperty(java.lang.String name, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
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.
setProperty
in interface org.xml.sax.XMLReader
name
- The property name, which is a fully-qualified URI.state
- The requested value for the property.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.public void setEntityResolver(org.xml.sax.EntityResolver 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.
setEntityResolver
in interface org.xml.sax.XMLReader
resolver
- The entity resolver.java.lang.NullPointerException
- If the resolver
argument is null.getEntityResolver()
public org.xml.sax.EntityResolver getEntityResolver()
getEntityResolver
in interface org.xml.sax.XMLReader
setEntityResolver(org.xml.sax.EntityResolver)
public void setDTDHandler(org.xml.sax.DTDHandler 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.
setDTDHandler
in interface org.xml.sax.XMLReader
handler
- The DTD handler.java.lang.NullPointerException
- If the handler
argument is null.getDTDHandler()
public org.xml.sax.DTDHandler getDTDHandler()
getDTDHandler
in interface org.xml.sax.XMLReader
setDTDHandler(org.xml.sax.DTDHandler)
public void setContentHandler(org.xml.sax.ContentHandler handler)
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 **
setContentHandler
in interface org.xml.sax.XMLReader
handler
- The content handler.java.lang.NullPointerException
- If the handler
argument is null.getContentHandler()
public org.xml.sax.ContentHandler getContentHandler()
getContentHandler
in interface org.xml.sax.XMLReader
setContentHandler(org.xml.sax.ContentHandler)
public void setErrorHandler(org.xml.sax.ErrorHandler 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.
setErrorHandler
in interface org.xml.sax.XMLReader
handler
- The error handler.java.lang.NullPointerException
- If the handler
argument is null.getErrorHandler()
public org.xml.sax.ErrorHandler getErrorHandler()
getErrorHandler
in interface org.xml.sax.XMLReader
setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXException
parse
in interface org.xml.sax.XMLReader
source
- The input source (the XML document to be transformed)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.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)
public void parse(java.lang.String systemId) throws java.io.IOException, org.xml.sax.SAXException
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.
parse
in interface org.xml.sax.XMLReader
systemId
- The system identifier (URI).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.parse(org.xml.sax.InputSource)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |