public class FilterStepHelper
extends java.lang.Object
Provides a mechanism for creating FilterStep
instances. A FilterStepHelper
stores a Saxon Processor
and
a URIResolver
, both of which are used in the creation of FilterStep
s. If you wish to use different instances of
these objects for different FilterStep
instances, we would recommend creating multiple instances of a
FilterStepHelper
.
The simplest, and recommended, way of creating a FilterStepHelper
is to call the creation method from
PipelinedComparatorS9
. This will use the Processor
and URIResolver
currently in use by the
PipelinedComparatorS9
to create FilterStep
instances.
PipelinedComparatorS9.newFilterStepHelper()
Constructor and Description |
---|
FilterStepHelper(net.sf.saxon.s9api.Processor p,
org.xml.sax.EntityResolver er,
javax.xml.transform.URIResolver ur)
|
Modifier and Type | Method and Description |
---|---|
FilterChain |
newFilterChain()
Creates a new, empty
FilterChain in which to add FilterStep s. |
FilterChain |
newFilterChain(java.util.List<FilterStep> filterSteps)
Create a new
FilterChain which is initially made up of the supplied FilterStep s. |
FilterChain |
newFilterChain(java.lang.String name)
Creates a new, empty, named
FilterChain in which to add FilterStep s. |
FilterStep |
newFilterStep(java.lang.Class<? extends org.xml.sax.helpers.XMLFilterImpl> filter,
java.lang.String name)
Creates a new
FilterStep Object from a Class that extends XMLFilterImpl . |
FilterStep |
newFilterStep(java.io.File filter,
java.lang.String name)
Creates a new
FilterStep Object from a File containing an XSLT stylesheet. |
FilterStep |
newFilterStep(java.net.URL filter,
java.lang.String name)
Creates a new
FilterStep Object from a URL referencing an XSLT stylesheet. |
FilterStep |
newFilterStep(org.xml.sax.helpers.XMLFilterImpl filter,
java.lang.String name)
Creates a
FilterStep from an instance of an XMLFilterImpl . |
FilterStep |
newFilterStep(net.sf.saxon.s9api.XsltExecutable filter,
java.lang.String name)
Creates a new
FilterStep Object from an XsltExecutable . |
FilterStep |
newFilterStep(net.sf.saxon.s9api.XsltExecutable filter,
java.lang.String name,
SummarisingErrorListener errorListener)
Creates a new
FilterStep Object from an XsltExecutable . |
FilterStep |
newFilterStepFromResource(java.lang.String resource,
java.lang.String name)
Creates a
FilterStep from a resource on the classpath. |
FilterChain |
newLockedFilterChain(java.util.List<FilterStep> filterSteps,
java.lang.String name)
Create a new
FilterChain which is made up of the supplied FilterStep s and cannot be subsequently modified. |
FilterChain |
newSingleStepFilterChain(java.lang.Class<? extends org.xml.sax.helpers.XMLFilterImpl> filter,
java.lang.String filterName)
|
FilterChain |
newSingleStepFilterChain(java.io.File filter,
java.lang.String filterName)
Creates a new
FilterChain containing a single FilterStep from a File containing an XSLT stylesheet.. |
FilterChain |
newSingleStepFilterChain(java.net.URL filter,
java.lang.String filterName)
Creates a new
FilterChain containing a single FilterStep from a URL referencing an XSLT stylesheet. |
FilterChain |
newSingleStepFilterChain(org.xml.sax.helpers.XMLFilterImpl filter,
java.lang.String filterName)
|
FilterChain |
newSingleStepFilterChain(net.sf.saxon.s9api.XsltExecutable filter,
java.lang.String filterName)
|
public FilterStepHelper(net.sf.saxon.s9api.Processor p, org.xml.sax.EntityResolver er, javax.xml.transform.URIResolver ur) throws ParserInstantiationException
Creates a FilterStepHelper
using the specified Processor
and URIResolver
.
N.B. The recommended way of constructing a FilterStepHelper
is to use
PipelinedComparatorS9.newFilterStepHelper()
p
- the Processor
to use when creating FilterStep
instanceser
- the EntityResolver
to use when creating FilterStep
instancesur
- the URIResolver
to use when creating FilterStep
instancesParserInstantiationException
- if there is an issue creating a parser for use by the FilterStepHelper
public FilterChain newFilterChain()
FilterChain
in which to add FilterStep
s.FilterChain
public FilterChain newFilterChain(java.lang.String name)
Creates a new, empty, named FilterChain
in which to add FilterStep
s.
If you intend to use a FilterChain
as a FilterStep
within another FilterChain
, it should be assigned
a name. This constructor enables you to set a name for the FilterChain
at the same time as creating it.
name
- the name to assign to the FilterChain
FilterChain
public FilterChain newFilterChain(java.util.List<FilterStep> filterSteps) throws DuplicateStepNameException, java.lang.IllegalArgumentException
Create a new FilterChain
which is initially made up of the supplied FilterStep
s.
The FilterStep
s will be ordered in the same order that the supplied List
defines.
N.B. If the List is null
or empty, an empty FilterChain
will be created.
filterSteps
- a List
of FilterStep
s that make up the FilterChain
FilterChain
made up of the supplied FilterStep
sDuplicateStepNameException
- if there is more than one FilterStep
with a given namejava.lang.IllegalArgumentException
- if the List contains any null
entriespublic FilterChain newSingleStepFilterChain(java.io.File filter, java.lang.String filterName) throws FilterConfigurationException
Creates a new FilterChain
containing a single FilterStep
from a File containing an XSLT stylesheet..
This helper method can be used to quickly populate a FilterChain
with a single step. Please note that it is still
possible to add more FilterStep
s to the chain.
filter
- an instance of a File
to use when creating the FilterStep
. This must be an XSLT file.filterName
- the name to use for the FilterStep
FilterChain
containing the single FilterStep
FilterConfigurationException
- if there are problems creating the FilterStep
from the XSLT stylesheet. Possible
problems include: reading the File, parsing the File, compiling the XSLT.public FilterChain newSingleStepFilterChain(java.lang.Class<? extends org.xml.sax.helpers.XMLFilterImpl> filter, java.lang.String filterName) throws FilterClassInstantiationException
Creates a new FilterChain
containing a single FilterStep
from a Class that extends
XMLFilterImpl
.
This helper method can be used to quickly populate a FilterChain
with a single step. Please note that it is still
possible to add more FilterStep
s to the chain.
filter
- an instance of a Class
that extends XMLFilterImpl
to use when creating the
FilterStep
filterName
- the name to use for the FilterStep
FilterChain
containing the single FilterStep
FilterClassInstantiationException
- if the supplied Class cannot be instantiated. The underlying cause will give
details on the reasons for the ExceptionFilterStepHelper.newFilterChain()
,
FilterStepHelper.newFilterStep(Class, String)
public FilterChain newSingleStepFilterChain(java.net.URL filter, java.lang.String filterName) throws FilterConfigurationException
Creates a new FilterChain
containing a single FilterStep
from a URL referencing an XSLT stylesheet.
This helper method can be used to quickly populate a FilterChain
with a single step. Please note that it is still
possible to add more FilterStep
s to the chain.
filter
- a URL referencing an XSLT filter to use as the FilterStep
filterName
- tthe name to use for the FilterStep
FilterChain
containing the single FilterStep
FilterConfigurationException
- if there are problems creating the FilterStep
from the XSLT stylesheet. Possible
problems include: connecting to and reading the URL, parsing the contents of the URL, compiling the XSLT.FilterStepHelper.newFilterChain()
,
FilterStepHelper.newFilterStep(URL, String)
public FilterChain newSingleStepFilterChain(org.xml.sax.helpers.XMLFilterImpl filter, java.lang.String filterName)
Creates a new FilterChain
containing a single FilterStep
from an instance of an XMLFilterImpl
.
This helper method can be used to quickly populate a FilterChain
with a single step. Please note that it is still
possible to add more FilterStep
s to the chain.
filter
- an XMLFilterImpl
instance to use as the basis for the FilterStep
filterName
- the name to use for the FilterStep
FilterChain
containing the single FilterStep
FilterStepHelper.newFilterChain()
,
FilterStepHelper.newFilterStep(XMLFilterImpl, String)
public FilterChain newSingleStepFilterChain(net.sf.saxon.s9api.XsltExecutable filter, java.lang.String filterName)
Creates a new FilterChain
containing a single FilterStep
from an XsltExecutable
.
This helper method can be used to quickly populate a FilterChain
with a single step. Please note that it is still
possible to add more FilterStep
s to the chain.
filter
- an XsltExecutable
instance to use as the basis for the FilterStep
filterName
- the name to use for the FilterStep
FilterChain
containing the single FilterStep
FilterStepHelper.newFilterChain()
,
FilterStepHelper.newFilterStep(XsltExecutable, String)
public FilterChain newLockedFilterChain(java.util.List<FilterStep> filterSteps, java.lang.String name) throws DuplicateStepNameException, java.lang.IllegalArgumentException
Create a new FilterChain
which is made up of the supplied FilterStep
s and cannot be subsequently modified.
FilterStep
parameters can be changed but the FilterStep
s that make up the FilterChain
cannot be
modified.
The FilterStep
s will be ordered in the same order that the supplied List
defines.
N.B. If the List is null
or empty, an empty FilterChain
will be created.
filterSteps
- a List
of FilterStep
s that make up the FilterChain
name
- a name to assign to the FilterChain
if it is being added as a FilterStep
FilterChain
made up of the supplied FilterStep
sDuplicateStepNameException
- if there is more than one FilterStep
with a given namejava.lang.IllegalArgumentException
- if the List contains any null
entriespublic FilterStep newFilterStep(java.lang.Class<? extends org.xml.sax.helpers.XMLFilterImpl> filter, java.lang.String name) throws FilterClassInstantiationException
Creates a new FilterStep
Object from a Class that extends XMLFilterImpl
.
filter
- a Class instance that is an extension of XMLFilterImpl
name
- the name to assign to the FilterStep
FilterStep
containing an instance of the XMLFilterImpl
FilterClassInstantiationException
- if the supplied Class cannot be instantiated. The underlying cause will give
details on the reasons for the Exceptionpublic FilterStep newFilterStep(java.io.File filter, java.lang.String name) throws FilterConfigurationException
Creates a new FilterStep
Object from a File containing an XSLT stylesheet.
filter
- a File Object representing an XSLT stylesheetname
- the name to assign to the FilterStep
FilterStep
containing a runnable version of the XSLT stylesheetFilterConfigurationException
- if there are problems creating the FilterStep
from the XSLT stylesheet. Possible
problems include: reading the File, parsing the File, compiling the XSLT.public FilterStep newFilterStep(java.net.URL filter, java.lang.String name) throws FilterConfigurationException
Creates a new FilterStep
Object from a URL referencing an XSLT stylesheet.
filter
- a URL Object pointing to an XSLT stylesheetname
- the name to assign to the FilterStep
FilterStep
containing a runnable version of the XSLT stylesheetFilterConfigurationException
- if there are problems creating the FilterStep
from the XSLT stylesheet. Possible
problems include: connecting to and reading the URL, parsing the contents of the URL, compiling the XSLT.public FilterStep newFilterStep(net.sf.saxon.s9api.XsltExecutable filter, java.lang.String name)
Creates a new FilterStep
Object from an XsltExecutable
.
filter
- the XsltExecutable Object to create the FilterStep
fromname
- the name to assign to the FilterStep
FilterStep
containing the XsltExecutable as its underlying step implementationpublic FilterStep newFilterStep(net.sf.saxon.s9api.XsltExecutable filter, java.lang.String name, SummarisingErrorListener errorListener)
Creates a new FilterStep
Object from an XsltExecutable
.
filter
- the XsltExecutable Object to create the FilterStep
fromname
- the name to assign to the FilterStep
errorListener
- an ErrorListener implementation for processing run-time errorsFilterStep
containing the XsltExecutable as its underlying step implementationpublic FilterStep newFilterStep(org.xml.sax.helpers.XMLFilterImpl filter, java.lang.String name)
Creates a FilterStep
from an instance of an XMLFilterImpl
.
filter
- an instance of an Object that extends XMLFilterImpl
name
- the name to assign to the FilterStep
FilterStep
containing an instance of the XMLFilterImpl
public FilterStep newFilterStepFromResource(java.lang.String resource, java.lang.String name) throws FilterConfigurationException
Creates a FilterStep
from a resource on the classpath.
It must be possible to compile the resource as an XSLT stylesheet.
resource
- a String representing the path of the resourcename
- the name to assign to the FilterStep
FilterStep
containing an underlying compiled XSLT stylesheet representation of the resourceFilterConfigurationException
- if the resource could not be found, loaded or compiled as an XSLT stylesheet