public class DynamicQueryContext
extends java.lang.Object
Constructor and Description |
---|
DynamicQueryContext(Configuration config)
Create the dynamic context for a query
|
Modifier and Type | Method and Description |
---|---|
void |
clearParameters()
Reset the parameters to an empty list.
|
Configuration |
getConfiguration()
Get the Configuration associated with this dynamic query context
|
Item |
getContextItem()
Get the context item for the query, as set using setContextItem().
|
DateTimeValue |
getCurrentDateTime()
Get the date and time set previously using
setCurrentDateTime(net.sf.saxon.value.DateTimeValue)
or null if none has been set. |
javax.xml.transform.ErrorListener |
getErrorListener()
Get the error listener.
|
Sequence |
getParameter(StructuredQName expandedName)
Get the actual value of a parameter to the query.
|
GlobalParameterSet |
getParameters()
Get all the supplied parameters.
|
int |
getSchemaValidationMode()
Ask whether source documents loaded using the doc(), document(), and collection()
functions, or supplied as a StreamSource or SAXSource to the transform() or addParameter() method
should be subjected to schema validation
|
Logger |
getTraceFunctionDestination()
Get the destination for output from the fn:trace() function.
|
TraceListener |
getTraceListener()
Get the trace listener.
|
UnparsedTextURIResolver |
getUnparsedTextURIResolver()
Get the URI resolver for unparsed text.
|
javax.xml.transform.URIResolver |
getURIResolver()
Get the URI resolver.
|
void |
initializeController(Controller controller)
Apply the settings from this DynamicQueryContext to a Controller
|
boolean |
isApplyFunctionConversionRulesToExternalVariables()
Ask whether the function conversion rules should be applied to supplied
parameter values.
|
void |
setApplyFunctionConversionRulesToExternalVariables(boolean convert)
Say whether the function conversion rules should be applied to supplied
parameter values.
|
void |
setContextItem(Item item)
Set the context item for evaluating the expression.
|
void |
setCurrentDateTime(DateTimeValue dateTime)
Set a value to be used as the current date and time for the query.
|
void |
setErrorListener(javax.xml.transform.ErrorListener listener)
Set the error listener.
|
void |
setParameter(StructuredQName expandedName,
Sequence value)
Set a parameter for the query.
|
void |
setSchemaValidationMode(int validationMode)
Say whether source documents loaded using the doc(), document(), and collection()
functions, or supplied as a StreamSource or SAXSource to the transform() or addParameter() method,
should be subjected to schema validation.
|
void |
setTraceFunctionDestination(Logger stream)
Set the destination for output from the fn:trace() function.
|
void |
setTraceListener(TraceListener listener)
Set the trace listener.
|
void |
setUnparsedTextURIResolver(UnparsedTextURIResolver resolver)
Set an object that will be used to resolve URIs used in
fn:unparsed-text() and related functions.
|
void |
setURIResolver(javax.xml.transform.URIResolver resolver)
Set an object that will be used to resolve URIs used in
fn:document() and related functions.
|
public DynamicQueryContext(Configuration config)
config
- the Saxon configurationpublic int getSchemaValidationMode()
Validation.DEFAULT
otherwise.public void setSchemaValidationMode(int validationMode)
validationMode
- the validation (or construction) mode to be used for source documents.
One of Validation.STRIP
, Validation.PRESERVE
, Validation.STRICT
,
Validation.LAX
public void setApplyFunctionConversionRulesToExternalVariables(boolean convert)
convert
- true if function conversion rules are to be applied to supplied
values; if false, the supplied value must match the required type exactly.public boolean isApplyFunctionConversionRulesToExternalVariables()
public void setContextItem(Item item)
Configuration.buildDocumentTree(javax.xml.transform.Source)
in the Configuration class.item
- The item that is to be the context item for the queryjava.lang.IllegalArgumentException
- if the supplied item is a node that was built under the wrong
Saxon Configurationjava.lang.NullPointerException
- if the supplied item is nullpublic Item getContextItem()
public void setParameter(StructuredQName expandedName, Sequence value)
expandedName
- The name of the parameter.
It is not an error to supply a value for a parameter that has not been
declared, the parameter will simply be ignored. If the parameter has
been declared in the query (as an external global variable) then it
will be initialized with the value supplied.value
- The value of the parameter.public void clearParameters()
public Sequence getParameter(StructuredQName expandedName)
expandedName
- the name of the required parameterpublic GlobalParameterSet getParameters()
public void setURIResolver(javax.xml.transform.URIResolver resolver)
resolver
- An object that implements the URIResolver interface, or
null.public javax.xml.transform.URIResolver getURIResolver()
public void setUnparsedTextURIResolver(UnparsedTextURIResolver resolver)
resolver
- An object that implements the UnparsedTextURIResolver interface, or
null.public UnparsedTextURIResolver getUnparsedTextURIResolver()
public void setErrorListener(javax.xml.transform.ErrorListener listener)
listener
- the ErrorListener to be usedpublic javax.xml.transform.ErrorListener getErrorListener()
public void setTraceListener(TraceListener listener)
listener
- the TraceListener to be usedpublic TraceListener getTraceListener()
public void setTraceFunctionDestination(Logger stream)
stream
- the PrintStream to which trace output will be sent. If set to
null, trace output is suppressed entirely. It is the caller's responsibility
to close the stream after use.public Logger getTraceFunctionDestination()
public DateTimeValue getCurrentDateTime()
setCurrentDateTime(net.sf.saxon.value.DateTimeValue)
or null if none has been set.public void setCurrentDateTime(DateTimeValue dateTime) throws XPathException
This method also has the effect of setting the implicit timezone.
dateTime
- The value to be used as the current date and time. This must include a timezone. The timezone
from this value will also be used as the implicit timezoneXPathException
- if the dateTime does not include a timezonepublic Configuration getConfiguration()
public void initializeController(Controller controller) throws XPathException
controller
- the Controller whose settings are to be initializedXPathException
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.