本文整理汇总了Java中org.jaxen.Context.getContextSupport方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getContextSupport方法的具体用法?Java Context.getContextSupport怎么用?Java Context.getContextSupport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jaxen.Context
的用法示例。
在下文中一共展示了Context.getContextSupport方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import org.jaxen.Context; //导入方法依赖的package包/类
public Object evaluate(Context context) throws JaxenException
{
ContextSupport support = context.getContextSupport();
Navigator nav = support.getNavigator();
Context absContext = new Context( support );
List contextNodes = context.getNodeSet();
if ( contextNodes.isEmpty() )
{
return Collections.EMPTY_LIST;
}
Object firstNode = contextNodes.get( 0 );
Object docNode = nav.getDocumentNode( firstNode );
if ( docNode == null )
{
return Collections.EMPTY_LIST;
}
List list = new SingletonList(docNode);
absContext.setNodeSet( list );
return super.evaluate( absContext );
}
示例2: evaluate
import org.jaxen.Context; //导入方法依赖的package包/类
public Object evaluate(Context context) throws JaxenException
{
List nodeSet = context.getNodeSet();
List contextNodeSet = new ArrayList(nodeSet);
ContextSupport support = context.getContextSupport();
Context stepContext = new Context(support);
Iterator stepIter = getSteps().iterator();
while ( stepIter.hasNext() )
{
Step eachStep = (Step) stepIter.next();
stepContext.setNodeSet(contextNodeSet);
contextNodeSet = eachStep.evaluate(stepContext);
// now we need to reverse the list if this is a reverse axis
if (isReverseAxis(eachStep)) {
Collections.reverse(contextNodeSet);
}
}
if (getSteps().size() > 1 || nodeSet.size() > 1) {
Collections.sort(contextNodeSet, new NodeComparator(support.getNavigator()));
}
return contextNodeSet;
}
示例3: evaluate
import org.jaxen.Context; //导入方法依赖的package包/类
public static List evaluate (Context context, Object arg)
throws FunctionCallException
{
List contextNodes = context.getNodeSet();
if (contextNodes.size() == 0)
return Collections.EMPTY_LIST;
Navigator nav = context.getNavigator();
String xpathString;
if ( arg instanceof String )
xpathString = (String)arg;
else
xpathString = StringFunction.evaluate(arg, nav);
try {
XPath xpath = nav.parseXPath(xpathString);
ContextSupport support = context.getContextSupport();
xpath.setVariableContext( support.getVariableContext() );
xpath.setFunctionContext( support.getFunctionContext() );
xpath.setNamespaceContext( support.getNamespaceContext() );
return xpath.selectNodes( context.duplicate() );
}
catch ( org.jaxen.saxpath.SAXPathException e ) {
throw new FunctionCallException(e.toString());
}
}
示例4: evaluate
import org.jaxen.Context; //导入方法依赖的package包/类
public List evaluate(final Context context) throws JaxenException
{
final List contextNodeSet = context.getNodeSet();
final IdentitySet unique = new IdentitySet();
final int contextSize = contextNodeSet.size();
// ???? try linked lists instead?
// ???? initial size for these?
final ArrayList interimSet = new ArrayList();
final ArrayList newNodeSet = new ArrayList();
final ContextSupport support = context.getContextSupport();
// ???? use iterator instead
for ( int i = 0 ; i < contextSize ; ++i )
{
Object eachContextNode = contextNodeSet.get( i );
/* See jaxen-106. Might be able to optimize this by doing
* specific matching for individual axes. For instance on namespace axis
* we should only get namespace nodes and on attribute axes we only get
* attribute nodes. Self and parent axes have single members.
* Children, descendant, ancestor, and sibling axes never
* see any attributes or namespaces
*/
Iterator axisNodeIter = axis.iterator(eachContextNode, support);
while ( axisNodeIter.hasNext() )
{
Object eachAxisNode = axisNodeIter.next();
if ( ! unique.contains( eachAxisNode ) )
{
if ( matches( eachAxisNode, support ) )
{
unique.add( eachAxisNode );
interimSet.add( eachAxisNode );
}
}
}
newNodeSet.addAll(getPredicateSet().evaluatePredicates(
interimSet, support ));
interimSet.clear();
}
return newNodeSet;
}