/** * Construct a new context as a copy of another. The new context is effectively added * to the top of a stack, and contains a pointer to the previous context */ public XPathContextMajor newContext() { Controller controller = new Controller(config); return controller.newXPathContext(); // notAllowed(); // return null; }
/** * Construct a new context as a copy of another. The new context is effectively added * to the top of a stack, and contains a pointer to the previous context */ public XPathContextMajor newContext() { Controller controller = new Controller(config); return controller.newXPathContext(); // notAllowed(); // return null; }
/** * Construct a new context as a copy of another. The new context is effectively added * to the top of a stack, and contains a pointer to the previous context */ public XPathContextMajor newContext() { Controller controller = new Controller(config); return controller.newXPathContext(); // notAllowed(); // return null; }
/** * Call this function. This method allows an XQuery function to be called directly from a Java * application. It creates the environment needed to achieve this * @param actualArgs the arguments supplied to the function. These must have the correct * types required by the function signature (it is the caller's responsibility to check this). * It is acceptable to supply a {@link net.sf.saxon.value.Closure} to represent a value whose * evaluation will be delayed until it is needed. The array must be the correct size to match * the number of arguments: again, it is the caller's responsibility to check this. * @param controller This provides the run-time context for evaluating the function. A Controller * may be obtained by calling {@link net.sf.saxon.query.XQueryExpression#newController}. This may * be used for a series of calls on functions defined in the same module as the XQueryExpression. * @return a Value representing the result of the function. */ public ValueRepresentation call(ValueRepresentation[] actualArgs, Controller controller) throws XPathException { return call(actualArgs, controller.newXPathContext()); }
/** * Call this function. This method allows an XQuery function to be called directly from a Java * application. It creates the environment needed to achieve this * @param actualArgs the arguments supplied to the function. These must have the correct * types required by the function signature (it is the caller's responsibility to check this). * It is acceptable to supply a {@link net.sf.saxon.value.Closure} to represent a value whose * evaluation will be delayed until it is needed. The array must be the correct size to match * the number of arguments: again, it is the caller's responsibility to check this. * @param controller This provides the run-time context for evaluating the function. A Controller * may be obtained by calling {@link net.sf.saxon.query.XQueryExpression#newController}. This may * be used for a series of calls on functions defined in the same module as the XQueryExpression. * @return a Value representing the result of the function. */ public ValueRepresentation call(ValueRepresentation[] actualArgs, Controller controller) throws XPathException { return call(actualArgs, controller.newXPathContext()); }
/** * Call this function. This method allows an XQuery function to be called directly from a Java * application. It creates the environment needed to achieve this * * @param actualArgs the arguments supplied to the function. These must have the correct * types required by the function signature (it is the caller's responsibility to check this). * It is acceptable to supply a {@link net.sf.saxon.value.Closure} to represent a value whose * evaluation will be delayed until it is needed. The array must be the correct size to match * the number of arguments: again, it is the caller's responsibility to check this. * @param controller This provides the run-time context for evaluating the function. A Controller * may be obtained by calling {@link net.sf.saxon.query.XQueryExpression#newController}. This may * be used for a series of calls on functions defined in the same module as the XQueryExpression. * @return a Value representing the result of the function. * @throws net.sf.saxon.trans.XPathException if a dynamic error occurs while evaluating the function. */ public Sequence<?> call(Sequence[] actualArgs, Controller controller) throws XPathException { return call(controller.newXPathContext(), actualArgs); }
/** * Call this function. This method allows an XQuery function to be called directly from a Java * application. It creates the environment needed to achieve this * * @param actualArgs the arguments supplied to the function. These must have the correct * types required by the function signature (it is the caller's responsibility to check this). * It is acceptable to supply a {@link net.sf.saxon.value.Closure} to represent a value whose * evaluation will be delayed until it is needed. The array must be the correct size to match * the number of arguments: again, it is the caller's responsibility to check this. * @param controller This provides the run-time context for evaluating the function. A Controller * may be obtained by calling {@link net.sf.saxon.query.XQueryExpression#newController}. This may * be used for a series of calls on functions defined in the same module as the XQueryExpression. * @return a Value representing the result of the function. * @throws net.sf.saxon.trans.XPathException if a dynamic error occurs while evaluating the function. */ public Sequence<?> call(Sequence[] actualArgs, Controller controller) throws XPathException { return call(controller.newXPathContext(), actualArgs); }
final XPathContextMajor aXPathContext = m_aXQController.newXPathContext ();
protected XPathContextMajor initialContext(DynamicQueryContext dynamicEnv, Controller controller) throws XPathException { Item<?> contextItem = controller.getGlobalContextItem(); XPathContextMajor context = controller.newXPathContext(); if (contextItem != null) { ManualIterator<Item<?>> single = new ManualIterator<>(contextItem); context.setCurrentIterator(single); controller.setGlobalContextItem(contextItem); } return context; }
protected XPathContextMajor initialContext(DynamicQueryContext dynamicEnv, Controller controller) throws XPathException { Item<?> contextItem = controller.getGlobalContextItem(); XPathContextMajor context = controller.newXPathContext(); if (contextItem != null) { ManualIterator<Item<?>> single = new ManualIterator<>(contextItem); context.setCurrentIterator(single); controller.setGlobalContextItem(contextItem); } return context; }
/** * Initialize the controller ready for a new transformation. This method should not normally be called by * users (it is done automatically when transform() is invoked). However, it is available as a low-level API * especially for use with XQuery. * * @param params the values of stylesheet parameters. Changed in 9.9.1.1 so this no longer includes * static parameters (which are already available in the {@link PreparedStylesheet}). * @throws XPathException if an error occurs, for example if a required parameter is not supplied. */ public void initializeController(GlobalParameterSet params) throws XPathException { // get a new bindery, to clear out any variables from previous runs binderies = new HashMap<>(); // if parameters were supplied, set them up try { executable.checkSuppliedParameters(params); } catch (XPathException e) { if (!e.hasBeenReported()) { getErrorListener().fatalError(e); throw e; } } globalParameters = params; // Check the global context item globalContextItem = executable.checkInitialContextItem(globalContextItem, newXPathContext()); if (traceListener != null) { traceListener.open(this); preEvaluateGlobals(newXPathContext()); } }
/** * Initialize the controller ready for a new transformation. This method should not normally be called by * users (it is done automatically when transform() is invoked). However, it is available as a low-level API * especially for use with XQuery. * * @param params the values of stylesheet parameters. Changed in 9.9.0.2 so this no longer includes * static parameters (which are already available in the {@link PreparedStylesheet}). * @throws XPathException if an error occurs, for example if a required parameter is not supplied. */ public void initializeController(GlobalParameterSet params) throws XPathException { // get a new bindery, to clear out any variables from previous runs binderies = new HashMap<>(); // if parameters were supplied, set them up try { executable.checkSuppliedParameters(params); } catch (XPathException e) { if (!e.hasBeenReported()) { getErrorListener().fatalError(e); throw e; } } globalParameters = params; // Check the global context item globalContextItem = executable.checkInitialContextItem(globalContextItem, newXPathContext()); if (traceListener != null) { traceListener.open(this); preEvaluateGlobals(newXPathContext()); } }
public void setPipelineConfiguration(PipelineConfiguration pipe) { if (pipe != null) { super.setPipelineConfiguration(pipe); if (context == null) { Controller controller = pipe.getController(); if (controller != null) { context = controller.newXPathContext(); } } if (element == null) { element = new Orphan(pipe.getConfiguration()); element.setNodeKind(Type.ELEMENT); } } }
public void setPipelineConfiguration(PipelineConfiguration pipe) { if (pipe != null) { super.setPipelineConfiguration(pipe); if (context == null) { Controller controller = pipe.getController(); if (controller != null) { context = controller.newXPathContext(); } } if (element == null) { element = new Orphan(pipe.getConfiguration()); element.setNodeKind(Type.ELEMENT); } } }
public void setPipelineConfiguration(PipelineConfiguration pipe) { if (pipe != null) { super.setPipelineConfiguration(pipe); if (context == null) { Controller controller = pipe.getController(); if (controller != null) { context = controller.newXPathContext(); } } if (element == null) { element = new Orphan(pipe.getConfiguration()); element.setNodeKind(Type.ELEMENT); } } }
return createDynamicContext(contextItem); } else { XPathContextMajor context = controller.newXPathContext(); context.openStackFrame(stackFrameMap); XPathDynamicContext dc = new XPathDynamicContext(env.getRequiredContextItemType(), context, stackFrameMap);
private XPathContext makeDynamicContext(UseWhenStaticContext staticContext) throws XPathException { Controller controller = new Controller(getConfiguration()); controller.getExecutable().setFunctionLibrary((FunctionLibraryList) staticContext.getFunctionLibrary()); if (staticContext.getXPathVersion() < 30) { controller.setURIResolver(new URIPreventer()); } controller.setCurrentDateTime(currentDateTime); // this is to ensure that all use-when expressions in a module use the same date and time XPathContext dynamicContext = controller.newXPathContext(); dynamicContext = dynamicContext.newCleanContext(); return dynamicContext; }
private XPathContext makeDynamicContext(UseWhenStaticContext staticContext) throws XPathException { Controller controller = new Controller(getConfiguration()); controller.getExecutable().setFunctionLibrary((FunctionLibraryList) staticContext.getFunctionLibrary()); if (staticContext.getXPathVersion() < 30) { controller.setURIResolver(new URIPreventer()); } controller.setCurrentDateTime(currentDateTime); // this is to ensure that all use-when expressions in a module use the same date and time XPathContext dynamicContext = controller.newXPathContext(); dynamicContext = dynamicContext.newCleanContext(); return dynamicContext; }
private XPathContextMajor initialContext(DynamicQueryContext dynamicEnv, Controller controller) throws XPathException { Item contextItem = dynamicEnv.getContextItem(); controller.defineGlobalParameters(); XPathContextMajor context = controller.newXPathContext(); if (contextItem != null) { if (!staticContext.getUserQueryContext().getRequiredContextItemType().matchesItem( contextItem, false, dynamicEnv.getConfiguration())) { throw new XPathException("The supplied context item does not match the required context item type"); } UnfailingIterator single = SingletonIterator.makeIterator(contextItem); single.next(); context.setCurrentIterator(single); controller.setInitialContextItem(contextItem); } return context; }
private XPathContextMajor initialContext(DynamicQueryContext dynamicEnv, Controller controller) throws XPathException { Item contextItem = dynamicEnv.getContextItem(); controller.defineGlobalParameters(); XPathContextMajor context = controller.newXPathContext(); if (contextItem != null) { if (!staticContext.getUserQueryContext().getRequiredContextItemType().matchesItem( contextItem, false, dynamicEnv.getConfiguration())) { throw new XPathException("The supplied context item does not match the required context item type"); } UnfailingIterator single = SingletonIterator.makeIterator(contextItem); single.next(); context.setCurrentIterator(single); controller.setInitialContextItem(contextItem); } return context; }