gpt4 book ai didi

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

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

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

XPathContextMajor.setCurrentIterator介绍

暂无

代码示例

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

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;
}

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

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;
}

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

/**
 * Return an Iterator to iterate over the values of the sequence. 
 *
 * @exception XPathException if any dynamic error occurs evaluating the
 *     expression
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *     of the expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  SequenceIterator master = select.iterate(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentTemplateRule(null);
  c2.setCurrentIterator(master);
  master = new ContextMappingIterator(this, c2);
  return master;
}

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

/**
 * Return an Iterator to iterate over the values of the sequence. 
 *
 * @exception XPathException if any dynamic error occurs evaluating the
 *     expression
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *     of the expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  SequenceIterator master = select.iterate(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentTemplateRule(null);
  c2.setCurrentIterator(master);
  master = new ContextMappingIterator(this, c2);
  return master;
}

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

/**
 * Set the context item for evaluation of the XPath Expression
 * @param item the context item
 * @throws XPathException if the node is in a document that was built under the wrong configuration
 */
public void setContextItem(Item item) throws XPathException {
  if (item instanceof NodeInfo) {
    if (!((NodeInfo)item).getConfiguration().isCompatible(contextObject.getConfiguration())) {
      throw new XPathException(
          "Supplied node must be built using the same or a compatible Configuration",
          SaxonErrorCode.SXXP0004);
    }
  }
  UnfailingIterator iter = SingletonIterator.makeIterator(item);
  iter.next();
  contextObject.setCurrentIterator(iter);
}

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

/**
 * Set the context item for evaluation of the XPath Expression
 * @param item the context item
 * @throws XPathException if the node is in a document that was built under the wrong configuration
 */
public void setContextItem(Item item) throws XPathException {
  if (item instanceof NodeInfo) {
    if (!((NodeInfo)item).getConfiguration().isCompatible(contextObject.getConfiguration())) {
      throw new XPathException(
          "Supplied node must be built using the same or a compatible Configuration",
          SaxonErrorCode.SXXP0004);
    }
  }
  UnfailingIterator iter = SingletonIterator.makeIterator(item);
  iter.next();
  contextObject.setCurrentIterator(iter);
}

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

/**
 * Return an Iterator to iterate over the values of a sequence. The value of every
 * expression can be regarded as a sequence, so this method is supported for all
 * expressions. This default implementation relies on the process() method: it
 * "pushes" the results of the instruction to a sequence in memory, and then
 * iterates over this in-memory sequence.
 * <p/>
 * In principle instructions should implement a pipelined iterate() method that
 * avoids the overhead of intermediate storage.
 *
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *         of the expression
 * @throws XPathException if any dynamic error occurs evaluating the
 *                        expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  GroupIterator master = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentIterator(master);
  c2.setCurrentGroupIterator(master);
  c2.setCurrentTemplateRule(null);
  return new ContextMappingIterator(this, c2);
}

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

/**
 * Return an Iterator to iterate over the values of a sequence. The value of every
 * expression can be regarded as a sequence, so this method is supported for all
 * expressions. This default implementation handles iteration for expressions that
 * return singleton values: for non-singleton expressions, the subclass must
 * provide its own implementation.
 *
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *         of the expression
 * @throws net.sf.saxon.trans.XPathException
 *          if any dynamic error occurs evaluating the
 *          expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  RegexIterator iter = getRegexIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentIterator(iter);
  c2.setCurrentRegexIterator(iter);
  AnalyzeMappingFunction fn = new AnalyzeMappingFunction(iter, c2);
  return new ContextMappingIterator(fn, c2);
}

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

/**
 * Return an Iterator to iterate over the values of a sequence. The value of every
 * expression can be regarded as a sequence, so this method is supported for all
 * expressions. This default implementation relies on the process() method: it
 * "pushes" the results of the instruction to a sequence in memory, and then
 * iterates over this in-memory sequence.
 * <p/>
 * In principle instructions should implement a pipelined iterate() method that
 * avoids the overhead of intermediate storage.
 *
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *         of the expression
 * @throws XPathException if any dynamic error occurs evaluating the
 *                        expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  GroupIterator master = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentIterator(master);
  c2.setCurrentGroupIterator(master);
  c2.setCurrentTemplateRule(null);
  return new ContextMappingIterator(this, c2);
}

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

/**
 * Return an Iterator to iterate over the values of a sequence. The value of every
 * expression can be regarded as a sequence, so this method is supported for all
 * expressions. This default implementation handles iteration for expressions that
 * return singleton values: for non-singleton expressions, the subclass must
 * provide its own implementation.
 *
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *         of the expression
 * @throws net.sf.saxon.trans.XPathException
 *          if any dynamic error occurs evaluating the
 *          expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  RegexIterator iter = getRegexIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentIterator(iter);
  c2.setCurrentRegexIterator(iter);
  AnalyzeMappingFunction fn = new AnalyzeMappingFunction(iter, c2);
  return new ContextMappingIterator(fn, c2);
}

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

/**
 * Evaluate the variable. That is,
 * get the value of the select expression if present or the content
 * of the element otherwise, either as a tree or as a sequence
*/
public ValueRepresentation getSelectValue(XPathContext context) throws XPathException {
  if (select==null) {
    throw new AssertionError("*** No select expression for global variable $" +
        getVariableQName().getDisplayName() + "!!");
  } else {
    XPathContextMajor c2 = context.newCleanContext();
    c2.setOrigin(this);
    UnfailingIterator initialNode =
        SingletonIterator.makeIterator(c2.getController().getContextForGlobalVariables());
    initialNode.next();
    c2.setCurrentIterator(initialNode);
    if (stackFrameMap != null) {
      c2.openStackFrame(stackFrameMap);
    }
    return ExpressionTool.evaluate(select, evaluationMode, c2, referenceCount);
  }
}

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

/**
 * Evaluate the variable. That is,
 * get the value of the select expression if present or the content
 * of the element otherwise, either as a tree or as a sequence
*/
public ValueRepresentation getSelectValue(XPathContext context) throws XPathException {
  if (select==null) {
    throw new AssertionError("*** No select expression for global variable $" +
        getVariableQName().getDisplayName() + "!!");
  } else {
    XPathContextMajor c2 = context.newCleanContext();
    c2.setOrigin(this);
    UnfailingIterator initialNode =
        SingletonIterator.makeIterator(c2.getController().getContextForGlobalVariables());
    initialNode.next();
    c2.setCurrentIterator(initialNode);
    if (stackFrameMap != null) {
      c2.openStackFrame(stackFrameMap);
    }
    return ExpressionTool.evaluate(select, evaluationMode, c2, referenceCount);
  }
}

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

/**
 * Build a data structure containing the values of the accumulator for each node in a document.
 * The data structure holds the value for all nodes where the value changes; the value for other
 * nodes is obtained by interpolation
 *
 * @param doc     the root of the tree for which the accumulator is to be evaluated
 * @param context the dynamic evaluation context
 * @throws XPathException if a dynamic error occurs while evaluating the accumulator
 */
public void buildIndex(NodeInfo doc, XPathContext context) throws XPathException {
  //System.err.println("Building accData " + this);
  if (building) {
    throw new XPathException("Accumulator " + accumulator.getAccumulatorName().getDisplayName() +
      " requires access to its own value", "XTDE3400");
  }
  building = true;
  Expression initialValue = accumulator.getInitialValueExpression();
  XPathContextMajor c2 = context.newContext();
  SlotManager sf = accumulator.getSlotManagerForInitialValueExpression();
  Sequence[] slots = new Sequence[sf.getNumberOfVariables()];
  c2.setStackFrame(sf, slots);
  c2.setCurrentIterator(new ManualIterator<>(doc));
  Sequence<?> val = initialValue.iterate(c2).materialize();
  values.add(new DataPoint(new Visit(doc, false), val));
  val = visit(doc, val, c2);
  values.add(new DataPoint(new Visit(doc, true), val));
  ((ArrayList) values).trimToSize();
  building = false;
  //diagnosticPrint();
}

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

/**
 * Set the context item for evaluation of the XPath Expression
 *
 * @param item the context item
 * @throws XPathException if the node is in a document that was built under the wrong configuration
 */
public void setContextItem(Item<?> item) throws XPathException {
  if (item instanceof NodeInfo) {
    if (!((NodeInfo) item).getConfiguration().isCompatible(contextObject.getConfiguration())) {
      throw new XPathException(
          "Supplied node must be built using the same or a compatible Configuration",
          SaxonErrorCode.SXXP0004);
    }
  }
  TypeHierarchy th = contextObject.getConfiguration().getTypeHierarchy();
  if (!contextItemType.matches(item, th)) {
    throw new XPathException("Supplied context item does not match required context item type " +
                     contextItemType);
  }
  ManualIterator<Item<?>> iter = new ManualIterator<>(item);
  contextObject.setCurrentIterator(iter);
}

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

/**
 * Set the context item for evaluation of the XPath Expression
 *
 * @param item the context item
 * @throws XPathException if the node is in a document that was built under the wrong configuration
 */
public void setContextItem(Item<?> item) throws XPathException {
  if (item instanceof NodeInfo) {
    if (!((NodeInfo) item).getConfiguration().isCompatible(contextObject.getConfiguration())) {
      throw new XPathException(
          "Supplied node must be built using the same or a compatible Configuration",
          SaxonErrorCode.SXXP0004);
    }
  }
  TypeHierarchy th = contextObject.getConfiguration().getTypeHierarchy();
  if (!contextItemType.matches(item, th)) {
    throw new XPathException("Supplied context item does not match required context item type " +
                     contextItemType);
  }
  ManualIterator<Item<?>> iter = new ManualIterator<>(item);
  contextObject.setCurrentIterator(iter);
}

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

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;
}

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

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;
}

代码示例来源: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));
  }
}

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

/**
* 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));
  }
}

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

/**
* 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));
  }
}

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