public static PathStep Create(XPath2Context context, object node) { PathStep res = node as PathStep; if (res != null) { return(res); } PathExprNode pathExpr = node as PathExprNode; if (pathExpr != null) { return(pathExpr.FirstStep); } return(new PathStep(AbstractNode.Create(context, node))); }
public static PathStep CreateFilter(XPath2Context context, object node, List <Object> predicateList) { if (predicateList.Count == 1) { AbstractNode predicate = AbstractNode.Create(context, predicateList[0]); ValueNode numexpr = predicate as ValueNode; if (numexpr != null && numexpr.Content is Integer) { PathStep res = Create(context, node); res.AddLast(new PathStep(numexpr.Content, XPath2ExprType.PositionFilter)); return(res); } } AbstractNode filterExpr = new FilterExprNode(context, node, predicateList); return(new PathStep(filterExpr)); }