public class DynamicQueryContext
extends java.lang.Object
Constructor | Description |
---|---|
DynamicQueryContext(Configuration config) |
Modifier and Type | Method | 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() or setContextNode().
|
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.
|
java.lang.Object |
getParameter(java.lang.String expandedName) |
Get the actual value of a parameter to the query.
|
java.util.HashMap |
getParameters() |
Get all the supplied parameters as a HashMap.
|
javax.xml.transform.URIResolver |
getURIResolver() |
Get the URI resolver.
|
void |
setContextItem(Item item) |
Set the context item for evaluating the expression.
|
void |
setContextNode(NodeInfo node) |
Deprecated.
From Saxon 8.7, the method
setContextItem(Item) is preferred |
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(java.lang.String expandedName,
java.lang.Object value) |
Set a parameter for the query.
|
void |
setParameterValue(java.lang.String expandedName,
ValueRepresentation value) |
Set a parameter for the query.
|
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)
public void setContextNode(NodeInfo node)
setContextItem(Item)
is preferredbuildDocument
in class QueryProcessor.node
- The node that is to be the context node for the querypublic void setContextItem(Item item)
buildDocument
in class QueryProcessor.item
- The item that is to be the context item for the querypublic Item getContextItem()
public void setParameter(java.lang.String expandedName, java.lang.Object value)
expandedName
- The name of the parameter in "{uri}local-name" format.
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. This can be any valid Java
object. It follows the same conversion rules as a value returned
from a Saxon extension function. An error will occur at query
execution time if the supplied value cannot be converted to the required
type as declared in the query. For precise control of the type of the
value, instantiate one of the classes in the net.sf.saxon.value package,
for example net.sf.saxon.value.DayTimeDuration.public void setParameterValue(java.lang.String expandedName, ValueRepresentation value)
expandedName
- The name of the parameter in "{uri}local-name" format.
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. This must be an XPath value in its Saxon
representation: no conversion occurs.public void clearParameters()
public java.lang.Object getParameter(java.lang.String expandedName)
expandedName
- the name of the required parameter, in
"{uri}local-name" formatpublic java.util.HashMap 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 setErrorListener(javax.xml.transform.ErrorListener listener)
listener
- the ErrorListener to be usedpublic javax.xml.transform.ErrorListener getErrorListener()
public DateTimeValue getCurrentDateTime()
setCurrentDateTime(net.sf.saxon.value.DateTimeValue)
or null if none has been set.public void setCurrentDateTime(DateTimeValue dateTime) throws XPathException
dateTime
- The value to be used as the current date and time. This must include a timezone.XPathException
public Configuration getConfiguration()