net.sf.saxon.query
public class DynamicQueryContext extends Object
Constructor Summary | |
---|---|
DynamicQueryContext(Configuration config)
Create the dynamic context for a query |
Method Summary | |
---|---|
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
or null if none has been set. |
ErrorListener | getErrorListener()
Get the error listener.
|
Object | getParameter(String expandedName)
Get the actual value of a parameter to the query.
|
HashMap<String,Object> | getParameters()
Get all the supplied parameters as a HashMap. |
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
|
PrintStream | getTraceFunctionDestination()
Get the destination for output from the fn:trace() function. |
TraceListener | getTraceListener()
Get the trace listener.
|
URIResolver | getURIResolver()
Get the URI resolver.
|
void | setContextItem(Item item)
Set the context item for evaluating the expression. |
void | setContextNode(NodeInfo node)
Set the context item for evaluating the expression to be a node. |
void | setCurrentDateTime(DateTimeValue dateTime)
Set a value to be used as the current date and time for the query. |
void | setErrorListener(ErrorListener listener)
Set the error listener. |
void | setParameter(String expandedName, Object value)
Set a parameter for the query.
|
void | setParameterValue(String expandedName, ValueRepresentation 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(PrintStream stream)
Set the destination for output from the fn:trace() function.
|
void | setTraceListener(TraceListener listener)
Set the trace listener. |
void | setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in
fn:document() and related functions.
|
Parameters: config the Saxon configuration
Since: 8.4.
Returns: the Configuration
Since: 8.8
Returns: the context item if set, or null otherwise.
Since: 8.4
Returns: the current date and time, if it has been set.
Since: 8.5
Returns: the ErrorListener in use
Since: 8.4
Parameters: expandedName the name of the required parameter, in "{uri}local-name" format
Returns: the value of the parameter, if it exists, or null otherwise
Returns: a HashMap containing all the parameters
Returns: the schema validation mode previously set using setSchemaValidationMode(), or the default mode DEFAULT otherwise.
Returns: the PrintStream to which trace output will be sent. If no explicitly destination has been set, returns System.err. If the destination has been set to null to suppress trace output, returns null.
Since: 9.1
Returns: the TraceListener in use, or null if none is in use
Since: 9.0
Returns: the user-supplied URI resolver if there is one, or the system-defined one otherwise
Since: 8.4
buildDocument
in class QueryProcessor.Parameters: item The item that is to be the context item for the query
Throws: IllegalArgumentException if the supplied item is a node that was built under the wrong Saxon Configuration
Since: 8.4
Deprecated: From Saxon 8.7, the method setContextItem is preferred
Set the context item for evaluating the expression to be a node. If this method is not called, the context node will be undefined. The context node is available as the value of the expression ".". To obtain a NodeInfo by parsing a source document, see the methodbuildDocument
in class QueryProcessor.
Parameters: node The node that is to be the context node for the query
Since: 8.4
This method also has the effect of setting the implicit timezone.
Parameters: 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 timezone
Since: 8.5
Parameters: listener the ErrorListener to be used
Since: 8.4
Parameters: 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.
Since: 8.4
Parameters: 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. The value is not checked at this stage against its required type; such checking will happen later, when the query is executed.
Since: 8.8
Parameters: validationMode the validation (or construction) mode to be used for source documents. One of STRIP, PRESERVE, STRICT, LAX
Since: 9.2
Parameters: 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.
Since: 9.1
Parameters: listener the TraceListener to be used
Since: 9.0
Parameters: resolver An object that implements the URIResolver interface, or null.
Since: 8.4