本文整理了Java中net.sf.saxon.om.Item.head()
方法的一些代码示例,展示了Item.head()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.head()
方法的具体详情如下:
包路径:net.sf.saxon.om.Item
类名称:Item
方法名:head
[英]Get the first item in the sequence. Differs from the superclass Sequence in that * no exception is thrown.
[中]获取序列中的第一项。与超类序列的不同之处在于*不会引发异常。
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Get the n'th item in the value, counting from 0
*
* @param n the index of the required item, with 0 representing the first item in the sequence
* @return the n'th item if it exists, or null otherwise
*/
default T itemAt(int n) {
return n == 0 ? head() : null;
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Get the n'th item in the value, counting from 0
*
* @param n the index of the required item, with 0 representing the first item in the sequence
* @return the n'th item if it exists, or null otherwise
*/
default T itemAt(int n) {
return n == 0 ? head() : null;
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
@Override
public Item getItem(XPathContext context) throws XPathException {
return doc.getUnderlyingValue().head();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Get an iterator over all the items in the sequence
*
* @return an iterator over all the items
*/
default UnfailingIterator<T> iterate() {
return SingletonIterator.makeIterator(head());
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Get an iterator over all the items in the sequence
*
* @return an iterator over all the items
*/
default UnfailingIterator<T> iterate() {
return SingletonIterator.makeIterator(head());
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Get the contents of this value in the form of a Java {@link java.util.Iterator},
* so that the sequence value can be used in a for-each expression
*
* @return an Iterator delivering a sequence of items containing this single item only
*/
default Iterator<T> iterator() {
return new MonoIterator<>(head());
}
代码示例来源:origin: com.xmlcalabash/xmlcalabash
@Override
public Item getItem(XPathContext context) throws XPathException {
return doc.getUnderlyingValue().head();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Get the contents of this value in the form of a Java {@link java.util.Iterator},
* so that the sequence value can be used in a for-each expression
*
* @return an Iterator delivering a sequence of items containing this single item only
*/
default Iterator<T> iterator() {
return new MonoIterator<>(head());
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Set the context item for evaluating the XPath expression.
* This may be either a node or an atomic value. Most commonly it will be a document node,
* which might be constructed using the {@link DocumentBuilder#build} method.
*
* @param item The context item for evaluating the expression. Must not be null.
* @throws SaxonApiException if an error occurs, for example because the type
* of item supplied does not match the required item type
*/
public void setContextItem(XdmItem item) throws SaxonApiException {
if (item == null) {
throw new NullPointerException("contextItem");
}
if (!exp.getInternalExpression().getPackageData().isSchemaAware()) {
Item it = item.getUnderlyingValue().head();
if (it instanceof NodeInfo && ((NodeInfo) it).getTreeInfo().isTyped()) {
throw new SaxonApiException(
"The supplied node has been schema-validated, but the XPath expression was compiled without schema-awareness");
}
}
try {
dynamicContext.setContextItem(item.getUnderlyingValue());
} catch (XPathException e) {
throw new SaxonApiException(e);
}
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
Set<MutableNodeInfo> affectedDocuments =
exp.getUnderlyingCompiledQuery().runUpdate(evaluator.getUnderlyingQueryContext());
Item initial = evaluator.getContextItem().getUnderlyingValue().head();
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Set the context item for evaluating the XPath expression.
* This may be either a node or an atomic value. Most commonly it will be a document node,
* which might be constructed using the {@link DocumentBuilder#build} method.
*
* @param item The context item for evaluating the expression. Must not be null.
* @throws SaxonApiException if an error occurs, for example because the type
* of item supplied does not match the required item type
*/
public void setContextItem(XdmItem item) throws SaxonApiException {
if (item == null) {
throw new NullPointerException("contextItem");
}
if (!exp.getInternalExpression().getPackageData().isSchemaAware()) {
Item it = item.getUnderlyingValue().head();
if (it instanceof NodeInfo && ((NodeInfo) it).getTreeInfo().isTyped()) {
throw new SaxonApiException(
"The supplied node has been schema-validated, but the XPath expression was compiled without schema-awareness");
}
}
try {
dynamicContext.setContextItem(item.getUnderlyingValue());
} catch (XPathException e) {
throw new SaxonApiException(e);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
Set<MutableNodeInfo> affectedDocuments =
exp.getUnderlyingCompiledQuery().runUpdate(evaluator.getUnderlyingQueryContext());
Item initial = evaluator.getContextItem().getUnderlyingValue().head();
内容来源于网络,如有侵权,请联系作者删除!