Search in sources :

Example 1 with ForwardStep

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep in project webtools.sourceediting by eclipse.

the class Normalizer method make_descendant_or_self.

private XPathExpr make_descendant_or_self() {
    Step desc_self_node = new ForwardStep(ForwardStep.DESCENDANT_OR_SELF, new AnyKindTest());
    StepExpr se = new AxisStep(desc_self_node, new ArrayList());
    return new XPathExpr(0, se);
}
Also used : ForwardStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep) StepExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.StepExpr) ArrayList(java.util.ArrayList) AxisStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep) ForwardStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep) ReverseStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep) Step(org.eclipse.wst.xml.xpath2.processor.internal.ast.Step) AxisStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep) AnyKindTest(org.eclipse.wst.xml.xpath2.processor.internal.ast.AnyKindTest) XPathExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)

Example 2 with ForwardStep

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep in project webtools.sourceediting by eclipse.

the class Normalizer method make_root_self_node.

private XPathExpr make_root_self_node() {
    // self::node()
    Step self_node = new ForwardStep(ForwardStep.SELF, new AnyKindTest());
    StepExpr self_node_expr = new AxisStep(self_node, new ArrayList());
    XPathExpr self_node_xpath = new XPathExpr(0, self_node_expr);
    // fn:root(self::node())
    Collection args = new ArrayList();
    args.add(self_node_xpath);
    XPathExpr xpe = make_function(new QName("fn", "root", FnFunctionLibrary.XPATH_FUNCTIONS_NS), args);
    return xpe;
}
Also used : ForwardStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep) QName(org.eclipse.wst.xml.xpath2.processor.internal.types.QName) StepExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.StepExpr) ArrayList(java.util.ArrayList) Collection(java.util.Collection) AxisStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep) ForwardStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep) ReverseStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep) Step(org.eclipse.wst.xml.xpath2.processor.internal.ast.Step) AxisStep(org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep) AnyKindTest(org.eclipse.wst.xml.xpath2.processor.internal.ast.AnyKindTest) XPathExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)

Example 3 with ForwardStep

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep in project webtools.sourceediting by eclipse.

the class DefaultEvaluator method visit.

/**
 * visit a forward step expression
 *
 * @param e
 *            is the forward step.
 * @return a new function
 */
public Object visit(ForwardStep e) {
    // get context node
    AnyType ci = focus().context_item();
    if (ci == null)
        report_error(DynamicError.contextUndefined());
    if (!(ci instanceof NodeType))
        report_error(TypeError.ci_not_node(ci.string_type()));
    NodeType cn = (NodeType) ci;
    // get the nodes on the axis
    ForwardAxis axis = e.iterator();
    ResultBuffer rb = new ResultBuffer();
    axis.iterate(cn, rb, _dc.getLimitNode());
    // get all nodes in the axis, and principal node
    Pair arg = new Pair(axis.principal_node_kind().string_type(), rb.getSequence());
    // do the name test
    _param = arg;
    ResultSequence rs = (ResultSequence) e.node_test().accept(this);
    return rs;
}
Also used : ResultBuffer(org.eclipse.wst.xml.xpath2.api.ResultBuffer) ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) NodeType(org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType) AnyType(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) ForwardAxis(org.eclipse.wst.xml.xpath2.processor.internal.ForwardAxis) VarExprPair(org.eclipse.wst.xml.xpath2.processor.internal.ast.VarExprPair)

Aggregations

ArrayList (java.util.ArrayList)2 AnyKindTest (org.eclipse.wst.xml.xpath2.processor.internal.ast.AnyKindTest)2 AxisStep (org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep)2 ForwardStep (org.eclipse.wst.xml.xpath2.processor.internal.ast.ForwardStep)2 ReverseStep (org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep)2 Step (org.eclipse.wst.xml.xpath2.processor.internal.ast.Step)2 StepExpr (org.eclipse.wst.xml.xpath2.processor.internal.ast.StepExpr)2 XPathExpr (org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)2 Collection (java.util.Collection)1 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)1 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)1 ForwardAxis (org.eclipse.wst.xml.xpath2.processor.internal.ForwardAxis)1 VarExprPair (org.eclipse.wst.xml.xpath2.processor.internal.ast.VarExprPair)1 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)1 NodeType (org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType)1 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)1