gpt4 book ai didi

net.sf.saxon.expr.XPathContextMajor.openStackFrame()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 19:15:40 24 4
gpt4 key购买 nike

本文整理了Java中net.sf.saxon.expr.XPathContextMajor.openStackFrame()方法的一些代码示例,展示了XPathContextMajor.openStackFrame()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPathContextMajor.openStackFrame()方法的具体详情如下:
包路径:net.sf.saxon.expr.XPathContextMajor
类名称:XPathContextMajor
方法名:openStackFrame

XPathContextMajor.openStackFrame介绍

[英]Create a new stack frame large enough to hold a given number of local variables, for which no stack frame map is available. This is used in particular when evaluating match patterns of template rules.
[中]创建一个足够大的新堆栈框架,以容纳给定数量的局部变量,但没有可用的堆栈框架映射。这在评估模板规则的匹配模式时尤其有用。

代码示例

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
 * Get a raw iterator over the results of the expression. This returns results without
 * any conversion of the returned items to "native" Java classes. This method is intended
 * for use by applications that need to process the results of the expression using
 * internal Saxon interfaces.
 * @param contextItem the context item for evaluating the expression
 * @return an iterator over the results of the expression, with no conversion of returned items
 * @since 9.0
*/
public SequenceIterator rawIterator(Item contextItem) throws XPathException {
  XPathContextMajor context = new XPathContextMajor(contextItem, executable);
  context.openStackFrame(stackFrameMap);
  return rawIterator(context);
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Create a dynamic context suitable for evaluating this expression, without supplying a context
 * item
 *
 * @return an XPathDynamicContext object representing a suitable dynamic context. This will
 *         be initialized with a stack frame suitable for holding the variables used by the
 *         expression.
 */
public XPathDynamicContext createDynamicContext() {
  XPathContextMajor context = new XPathContextMajor(null, executable);
  context.openStackFrame(stackFrameMap);
  return new XPathDynamicContext(env.getRequiredContextItemType(), context, stackFrameMap);
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
 * Create a dynamic context suitable for evaluating this expression
 * @param contextItem the initial context item, which may be null if no
 * context item is required, or if it is to be supplied later
 * @return an XPathDynamicContext object representing a suitable dynamic context. This will
 * be initialized with a stack frame suitable for holding the variables used by the
 * expression.
 */
public XPathDynamicContext createDynamicContext(Item contextItem) {
  XPathContextMajor context = new XPathContextMajor(contextItem, evaluator.getExecutable());
  context.openStackFrame(stackFrameMap);
  return new XPathDynamicContext(context, stackFrameMap);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Create a dynamic context suitable for evaluating this expression, without supplying a context
 * item
 *
 * @return an XPathDynamicContext object representing a suitable dynamic context. This will
 *         be initialized with a stack frame suitable for holding the variables used by the
 *         expression.
 */
public XPathDynamicContext createDynamicContext() {
  XPathContextMajor context = new XPathContextMajor(null, executable);
  context.openStackFrame(stackFrameMap);
  return new XPathDynamicContext(env.getRequiredContextItemType(), context, stackFrameMap);
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
 * Create a dynamic context suitable for evaluating this expression
 * @param contextItem the initial context item, which may be null if no
 * context item is required, or if it is to be supplied later
 * @return an XPathDynamicContext object representing a suitable dynamic context. This will
 * be initialized with a stack frame suitable for holding the variables used by the
 * expression.
 */
public XPathDynamicContext createDynamicContext(Item contextItem) {
  XPathContextMajor context = new XPathContextMajor(contextItem, evaluator.getExecutable());
  context.openStackFrame(stackFrameMap);
  return new XPathDynamicContext(context);
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Create a dynamic context suitable for evaluating this expression
 *
 * @param contextItem the initial context item, which may be null if no
 *                    context item is required, or if it is to be supplied later
 * @return an XPathDynamicContext object representing a suitable dynamic context. This will
 *         be initialized with a stack frame suitable for holding the variables used by the
 *         expression.
 * @throws XPathException if the context item does not match the required context item type
 *                        set up in the static context
 */
public XPathDynamicContext createDynamicContext(Item contextItem) throws XPathException {
  checkContextItemType(contextItem);
  XPathContextMajor context = new XPathContextMajor(contextItem, executable);
  context.openStackFrame(stackFrameMap);
  return new XPathDynamicContext(env.getRequiredContextItemType(), context, stackFrameMap);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Create a dynamic context suitable for evaluating this expression
 *
 * @param contextItem the initial context item, which may be null if no
 *                    context item is required, or if it is to be supplied later
 * @return an XPathDynamicContext object representing a suitable dynamic context. This will
 *         be initialized with a stack frame suitable for holding the variables used by the
 *         expression.
 * @throws XPathException if the context item does not match the required context item type
 *                        set up in the static context
 */
public XPathDynamicContext createDynamicContext(Item contextItem) throws XPathException {
  checkContextItemType(contextItem);
  XPathContextMajor context = new XPathContextMajor(contextItem, executable);
  context.openStackFrame(stackFrameMap);
  return new XPathDynamicContext(env.getRequiredContextItemType(), context, stackFrameMap);
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
 * Execute a prepared XPath expression, returning the results as a List. The context
 * node must have been set previously using {@link #setContextNode(net.sf.saxon.om.NodeInfo)}.
 * @return The results of the expression, as a List. The List represents the sequence
 * of items returned by the expression. Each item in the list will either be an instance
 * of net.sf.saxon.om.NodeInfo, representing a node, or a Java object representing an atomic value.
 * For the types of Java object that may be returned, see {@link #evaluate(Object, javax.xml.namespace.QName)}
 * with the second argument set to NODESET.
 * @deprecated since 9.0. This method is not present in the JAXP interface. Either use
 * the JAXP methods such as {@link #evaluate(Object, QName)}, or use the Saxon XPath
 * API instead of JAXP.
*/
public List evaluate() throws XPathException {
  XPathContextMajor context = new XPathContextMajor(contextNode, executable);
  context.openStackFrame(stackFrameMap);
  SequenceIterator iter = expression.iterate(context);
  SequenceExtent extent = new SequenceExtent(iter);
  return (List)extent.convertToJava(Object.class, context);
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
 * Make a new XPath context for evaluating patterns if there is any possibility that the
 * pattern uses local variables
 *
 * @param context The existing XPath context
 * @return a new XPath context (or the existing context if no new context was created)
 */
private XPathContext perhapsMakeNewContext(XPathContext context) {
  int patternLocals = context.getController().getExecutable().getLargestPatternStackFrame();
  if (patternLocals > 0) {
    context = context.newContext();
    context.setOriginatingConstructType(Location.CONTROLLER);
    ((XPathContextMajor)context).openStackFrame(patternLocals);
  }
  return context;
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

private String processShadowAttribute(String expression, String baseUri, AttributeLocation loc) throws XPathException {
  UseWhenStaticContext staticContext = new UseWhenStaticContext(compilation, startTag);
  staticContext.setBaseURI(baseUri);
  staticContext.setContainingLocation(loc);
  setNamespaceBindings(staticContext);
  Expression expr = AttributeValueTemplate.make(expression, staticContext);
  expr = typeCheck(expr, staticContext);
  SlotManager stackFrameMap = allocateSlots(expression, expr);
  XPathContext dynamicContext = makeDynamicContext(staticContext);
  ((XPathContextMajor) dynamicContext).openStackFrame(stackFrameMap);
  return expr.evaluateAsString(dynamicContext).toString();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

private String processShadowAttribute(String expression, String baseUri, AttributeLocation loc) throws XPathException {
  UseWhenStaticContext staticContext = new UseWhenStaticContext(compilation, startTag);
  staticContext.setBaseURI(baseUri);
  staticContext.setContainingLocation(loc);
  setNamespaceBindings(staticContext);
  Expression expr = AttributeValueTemplate.make(expression, staticContext);
  expr = typeCheck(expr, staticContext);
  SlotManager stackFrameMap = allocateSlots(expression, expr);
  XPathContext dynamicContext = makeDynamicContext(staticContext);
  ((XPathContextMajor) dynamicContext).openStackFrame(stackFrameMap);
  return expr.evaluateAsString(dynamicContext).toString();
}

代码示例来源:origin: net.sf.saxon/Saxon-B

/**
 * Make a new XPath context for evaluating patterns if there is any possibility that the
 * pattern uses local variables
 *
 * @param context The existing XPath context
 * @return a new XPath context (or the existing context if no new context was created)
 */
private XPathContext perhapsMakeNewContext(XPathContext context) {
  int patternLocals = context.getController().getExecutable().getLargestPatternStackFrame();
  if (patternLocals > 0) {
    context = context.newContext();
    context.setOrigin(context.getController());
    ((XPathContextMajor)context).openStackFrame(patternLocals);
  }
  return context;
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
 * Make a new XPath context for evaluating patterns if there is any possibility that the
 * pattern uses local variables
 *
 * @param context The existing XPath context
 * @return a new XPath context (or the existing context if no new context was created)
 */
private XPathContext perhapsMakeNewContext(XPathContext context) {
  int patternLocals = context.getController().getExecutable().getLargestPatternStackFrame();
  if (patternLocals > 0) {
    context = context.newContext();
    context.setOrigin(context.getController());
    ((XPathContextMajor)context).openStackFrame(patternLocals);
  }
  return context;
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
  * Process the template call encapsulated by this package.
  * @return another TailCall. This will never be the original call, but it may be the next
  * recursive call. For example, if A calls B which calls C which calls D, then B may return
  * a TailCall to A representing the call from B to C; when this is processed, the result may be
  * a TailCall representing the call from C to D.
   * @throws XPathException if a dynamic error occurs
  */
  public TailCall processLeavingTail() throws XPathException {
    Template nh = (Template)rule.getAction();
    XPathContextMajor c2 = evaluationContext.newContext();
    c2.setOrigin(NextMatch.this);
    c2.setLocalParameters(params);
    c2.setTunnelParameters(tunnelParams);
    c2.openStackFrame(nh.getStackFrameMap());
    // System.err.println("Tail call on template");
    return nh.applyLeavingTail(c2, rule);
  }
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Make a new XPath context for evaluating patterns if there is any possibility that the
 * pattern uses local variables
 *
 * @param context The existing XPath context
 * @return a new XPath context
 */
public XPathContext makeNewContext(XPathContext context) {
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(context.getController());   // WHY?
  c2.openStackFrame(getStackFrameSlotsNeeded());
  if (!(context.getCurrentComponent().getActor() instanceof Accumulator)) {
    c2.setCurrentComponent(context.getCurrentMode()); // bug 3706
  }
  return c2;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Make a new XPath context for evaluating patterns if there is any possibility that the
 * pattern uses local variables
 *
 * @param context The existing XPath context
 * @return a new XPath context
 */
public XPathContext makeNewContext(XPathContext context) {
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(context.getController());   // WHY?
  c2.openStackFrame(getStackFrameSlotsNeeded());
  if (!(context.getCurrentComponent().getActor() instanceof Accumulator)) {
    c2.setCurrentComponent(context.getCurrentMode()); // bug 3706
  }
  return c2;
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
 * Run the query returning the results as an EventIterator
 * @param controller The Controller used to run the query
 * @param dynamicEnv the XQuery dynamic context for evaluating the query
 * @return an EventIterator representing the results of the query as a sequence of events
 */
public EventIterator iterateEvents(Controller controller, DynamicQueryContext dynamicEnv) throws XPathException {
  initializeController(dynamicEnv, controller);
  XPathContextMajor context = initialContext(dynamicEnv, controller);
  // In tracing/debugging mode, evaluate all the global variables first
  if (controller.getConfiguration().getTraceListener() != null) {
    controller.preEvaluateGlobals(context);
  }
  context.openStackFrame(stackFrameMap);
  final Configuration config = executable.getConfiguration();
  EventIterator ei = expression.iterateEvents(context);
  //ei = new TracingEventIterator(EventStackIterator.flatten(ei));
  return new ComplexContentProcessor(config, ei);
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
 * Evaluate an attribute set
 * @param context the dynamic context
 * @throws XPathException if any failure occurs
 */
public void expand(XPathContext context) throws XPathException {
  // apply the content of any attribute sets mentioned in use-attribute-sets
  if (useAttributeSets != null) {
    AttributeSet.expand(useAttributeSets, context);
  }
  if (getStackFrameMap() != null) {
    XPathContextMajor c2 = context.newContext();
    c2.setOrigin(this);
    c2.openStackFrame(getStackFrameMap());
    getBody().process(c2);
  } else {
    getBody().process(context);
  }
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Evaluate a static expression (to initialize a static variable)
 *
 * @param expression the expression to be evaluated
 * @param locationId identifies the location of the expression in case error need to be reported
 * @param staticContext the static context for evaluation of the expression
 * @return the effective boolean value of the result of evaluating the expression
 * @throws XPathException if evaluation of the expression fails
 */
public Sequence<?> evaluateStatic(String expression, Location locationId, UseWhenStaticContext staticContext) throws XPathException {
  setNamespaceBindings(staticContext);
  Expression expr = ExpressionTool.make(expression, staticContext,
    0, Token.EOF, null);
  expr = typeCheck(expr, staticContext);
  SlotManager stackFrameMap = getPipelineConfiguration().getConfiguration().makeSlotManager();
  ExpressionTool.allocateSlots(expr, stackFrameMap.getNumberOfVariables(), stackFrameMap);
  XPathContext dynamicContext = makeDynamicContext(staticContext);
  ((XPathContextMajor) dynamicContext).openStackFrame(stackFrameMap);
  return expr.iterate(dynamicContext).materialize();
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
* Iterate over the results of the function
*/
public SequenceIterator iterate(XPathContext c) throws XPathException {
  PreparedExpression pexpr = prepareExpression(c);
  if (operation == EXPRESSION) {
    return SingletonIterator.makeIterator(new ObjectValue(pexpr));
  } else {
    XPathContextMajor c2 = c.newCleanContext();
    c2.setOrigin(details);
    c2.openStackFrame(pexpr.stackFrameMap);
    c2.setCurrentIterator(c.getCurrentIterator());
    for (int i=1; i<argument.length; i++) {
      int slot = pexpr.variables[i-1].getLocalSlotNumber();
      c2.setLocalVariable(slot, ExpressionTool.eagerEvaluate(argument[i],c));
    }
    return Value.getIterator(
        ExpressionTool.lazyEvaluate(pexpr.expression,  c2, 1));
  }
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com