gpt4 book ai didi

net.sf.saxon.sxpath.XPathVariable.getRequiredType()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 19:35:05 26 4
gpt4 key购买 nike

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

XPathVariable.getRequiredType介绍

[英]Get the required type of this variable. If no required type has been specified, the type item()* is returned.
[中]获取此变量的所需类型。如果未指定所需的类型,则返回类型item()*

代码示例

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

/**
 * Get the required item type of a declared variable in the static context of the expression.
 *
 * @param variableName the name of a declared variable
 * @return the required item type.
 *         <p>If the variable was explicitly declared, this will be the item type that was set when the
 *         variable was declared. If no item type was set, it will be {@link ItemType#ANY_ITEM}.</p>
 *         <p>If the variable was implicitly declared by reference (which can happen only when the
 *         <tt>allowUndeclaredVariables</tt> option is set), the returned type will be {@link ItemType#ANY_ITEM}.</p>
 *         <p>If no variable with the specified QName has been declared either explicitly or implicitly,
 *         the method returns null.</p>
 * @since 9.2
 */
/*@Nullable*/
public ItemType getRequiredItemTypeForVariable(QName variableName) {
  XPathVariable var = env.getExternalVariable(variableName.getStructuredQName());
  if (var == null) {
    return null;
  } else {
    return new ConstructedItemType(var.getRequiredType().getPrimaryType(), processor);
  }
}

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

/**
 * Get the required cardinality of a declared variable in the static context of the expression.
 *
 * @param variableName the name of a declared variable
 * @return the required cardinality.
 *         <p>If the variable was explicitly declared, this will be the occurrence indicator that was set when the
 *         variable was declared. If no item type was set, it will be {@link OccurrenceIndicator#ZERO_OR_MORE}.</p>
 *         <p>If the variable was implicitly declared by reference (which can happen only when the
 *         <tt>allowUndeclaredVariables</tt> option is set), the returned type will be
 *         {@link OccurrenceIndicator#ZERO_OR_MORE}.</p>
 *         <p>If no variable with the specified QName has been declared either explicitly or implicitly,
 *         the method returns null.</p>
 * @since 9.2
 */
public OccurrenceIndicator getRequiredCardinalityForVariable(QName variableName) {
  XPathVariable var = env.getExternalVariable(variableName.getStructuredQName());
  if (var == null) {
    return null;
  } else {
    return OccurrenceIndicator.getOccurrenceIndicator(var.getRequiredType().getCardinality());
  }
}

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

/**
 * Get the required item type of a declared variable in the static context of the expression.
 *
 * @param variableName the name of a declared variable
 * @return the required item type.
 *         <p>If the variable was explicitly declared, this will be the item type that was set when the
 *         variable was declared. If no item type was set, it will be {@link ItemType#ANY_ITEM}.</p>
 *         <p>If the variable was implicitly declared by reference (which can happen only when the
 *         <tt>allowUndeclaredVariables</tt> option is set), the returned type will be {@link ItemType#ANY_ITEM}.</p>
 *         <p>If no variable with the specified QName has been declared either explicitly or implicitly,
 *         the method returns null.</p>
 * @since 9.2
 */
/*@Nullable*/
public ItemType getRequiredItemTypeForVariable(QName variableName) {
  XPathVariable var = env.getExternalVariable(variableName.getStructuredQName());
  if (var == null) {
    return null;
  } else {
    return new ConstructedItemType(var.getRequiredType().getPrimaryType(), processor);
  }
}

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

/**
 * Get the required cardinality of a declared variable in the static context of the expression.
 *
 * @param variableName the name of a declared variable
 * @return the required cardinality.
 *         <p>If the variable was explicitly declared, this will be the occurrence indicator that was set when the
 *         variable was declared. If no item type was set, it will be {@link OccurrenceIndicator#ZERO_OR_MORE}.</p>
 *         <p>If the variable was implicitly declared by reference (which can happen only when the
 *         <tt>allowUndeclaredVariables</tt> option is set), the returned type will be
 *         {@link OccurrenceIndicator#ZERO_OR_MORE}.</p>
 *         <p>If no variable with the specified QName has been declared either explicitly or implicitly,
 *         the method returns null.</p>
 * @since 9.2
 */
public OccurrenceIndicator getRequiredCardinalityForVariable(QName variableName) {
  XPathVariable var = env.getExternalVariable(variableName.getStructuredQName());
  if (var == null) {
    return null;
  } else {
    return OccurrenceIndicator.getOccurrenceIndicator(var.getRequiredType().getCardinality());
  }
}

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

private XPathExecutable internalCompile(String source) throws SaxonApiException {
  try {
    env.getDecimalFormatManager().checkConsistency();
  } catch (net.sf.saxon.trans.XPathException e) {
    throw new SaxonApiException(e);
  }
  XPathEvaluator eval = evaluator;
  IndependentContext ic = env;
  if (ic.isAllowUndeclaredVariables()) {
    // self-declaring variables modify the static context. The XPathCompiler must not change state
    // as the result of compiling an expression, so we need to copy the static context.
    eval = new XPathEvaluator(processor.getUnderlyingConfiguration());
    ic = new IndependentContext(env);
    eval.setStaticContext(ic);
    for (Iterator iter = env.iterateExternalVariables(); iter.hasNext(); ) {
      XPathVariable var = (XPathVariable) iter.next();
      XPathVariable var2 = ic.declareVariable(var.getVariableQName());
      var2.setRequiredType(var.getRequiredType());
    }
  }
  try {
    XPathExpression cexp = eval.createExpression(source);
    return new XPathExecutable(cexp, processor, ic);
  } catch (XPathException e) {
    throw new SaxonApiException(e);
  }
}

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

private XPathExecutable internalCompile(String source) throws SaxonApiException {
  try {
    env.getDecimalFormatManager().checkConsistency();
  } catch (net.sf.saxon.trans.XPathException e) {
    throw new SaxonApiException(e);
  }
  XPathEvaluator eval = evaluator;
  IndependentContext ic = env;
  if (ic.isAllowUndeclaredVariables()) {
    // self-declaring variables modify the static context. The XPathCompiler must not change state
    // as the result of compiling an expression, so we need to copy the static context.
    eval = new XPathEvaluator(processor.getUnderlyingConfiguration());
    ic = new IndependentContext(env);
    eval.setStaticContext(ic);
    for (Iterator iter = env.iterateExternalVariables(); iter.hasNext(); ) {
      XPathVariable var = (XPathVariable) iter.next();
      XPathVariable var2 = ic.declareVariable(var.getVariableQName());
      var2.setRequiredType(var.getRequiredType());
    }
  }
  try {
    XPathExpression cexp = eval.createExpression(source);
    return new XPathExecutable(cexp, processor, ic);
  } catch (XPathException e) {
    throw new SaxonApiException(e);
  }
}

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

SequenceType requiredType = variable.getRequiredType();
if (requiredType != SequenceType.ANY_SEQUENCE) {
  XPathException err = TypeChecker.testConformance(value, requiredType, contextObject);

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

SequenceType requiredType = variable.getRequiredType();
if (requiredType != SequenceType.ANY_SEQUENCE) {
  XPathException err = TypeChecker.testConformance(value, requiredType, contextObject);

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

SequenceType requiredType = variable.getRequiredType();
if (requiredType != SequenceType.ANY_SEQUENCE) {
  XPathException err = TypeChecker.testConformance(value, requiredType, contextObject);

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

SequenceType requiredType = variable.getRequiredType();
if (requiredType != SequenceType.ANY_SEQUENCE) {
  XPathException err = TypeChecker.testConformance(value, requiredType, contextObject);

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