本文整理汇总了Java中com.sun.org.apache.xpath.internal.axes.LocPathIterator类的典型用法代码示例。如果您正苦于以下问题:Java LocPathIterator类的具体用法?Java LocPathIterator怎么用?Java LocPathIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocPathIterator类属于com.sun.org.apache.xpath.internal.axes包,在下文中一共展示了LocPathIterator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.sun.org.apache.xpath.internal.axes.LocPathIterator; //导入依赖的package包/类
/**
* Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
SubContextList subContextList = xctxt.getCurrentNodeList();
int currentNode = DTM.NULL;
if (null != subContextList) {
if (subContextList instanceof PredicatedNodeTest) {
LocPathIterator iter = ((PredicatedNodeTest)subContextList)
.getLocPathIterator();
currentNode = iter.getCurrentContextNode();
} else if(subContextList instanceof StepPattern) {
throw new RuntimeException(XSLMessages.createMessage(
XSLTErrorResources.ER_PROCESSOR_ERROR,null));
}
} else {
// not predicate => ContextNode == CurrentNode
currentNode = xctxt.getContextNode();
}
return new XNodeSet(currentNode, xctxt.getDTMManager());
}
示例2: eval
import com.sun.org.apache.xpath.internal.axes.LocPathIterator; //导入依赖的package包/类
/**
* Evaluate an XPath context using the internal XPath engine
* @param contextItem The XPath context
* @param xpath The internal XPath engine
* @return an XObject
* @throws javax.xml.transform.TransformerException If the expression cannot be evaluated.
*/
XObject eval(Object contextItem, com.sun.org.apache.xpath.internal.XPath xpath)
throws javax.xml.transform.TransformerException {
com.sun.org.apache.xpath.internal.XPathContext xpathSupport;
if (contextItem == null && xpath.getExpression() instanceof LocPathIterator) {
// the operation must have no dependency on the context that is null
throw new TransformerException(XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_CONTEXT_CAN_NOT_BE_NULL,
new Object[] {}));
}
if (functionResolver != null) {
JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
functionResolver, featureSecureProcessing, featureManager);
xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext(jep);
} else {
xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
}
xpathSupport.setVarStack(new JAXPVariableStack(variableResolver));
XObject xobj;
Node contextNode = (Node)contextItem;
// We always need to have a ContextNode with Xalan XPath implementation
// To allow simple expression evaluation like 1+1 we are setting
// dummy Document as Context Node
if (contextNode == null) {
xobj = xpath.execute(xpathSupport, DTM.NULL, prefixResolver);
} else {
xobj = xpath.execute(xpathSupport, contextNode, prefixResolver);
}
return xobj;
}
示例3: visitLocationPath
import com.sun.org.apache.xpath.internal.axes.LocPathIterator; //导入依赖的package包/类
/**
* Visit a LocationPath.
* @param owner The owner of the expression, to which the expression can
* be reset if rewriting takes place.
* @param path The LocationPath object.
* @return true if the sub expressions should be traversed.
*/
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
return true;
}