Search in sources :

Example 26 with QName

use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName 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 27 with QName

use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.

the class StaticNameResolver method visit.

/**
 * Validate an attribute test.
 *
 * @param e
 *            is the expression.
 * @return null.
 */
// XXX NO CHECK ?
public Object visit(AttributeTest e) {
    QName name = e.name();
    if (name != null) {
        if (!expandItemQName(name))
            reportBadPrefix(name.prefix());
    }
    name = e.type();
    if (name != null) {
        if (!expandItemTypeQName(name))
            reportBadPrefix(name.prefix());
    }
    return null;
}
Also used : QName(org.eclipse.wst.xml.xpath2.processor.internal.types.QName)

Example 28 with QName

use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.

the class StaticNameResolver method doForExpr.

// does a for and a quantified expression
// takes the iterator for var expr paris
private void doForExpr(Iterator iter, Expr expr) {
    int scopes = 0;
    // add variables to scope and check the binding sequence
    while (iter.hasNext()) {
        VarExprPair pair = (VarExprPair) iter.next();
        QName var = pair.varname();
        if (!expandVarQName(var))
            reportBadPrefix(var.prefix());
        Expr e = pair.expr();
        e.accept(this);
        pushScope(var, BuiltinTypeLibrary.XS_ANYTYPE);
        scopes++;
    }
    expr.accept(this);
    // kill the scopes
    for (int i = 0; i < scopes; i++) popScope();
}
Also used : PipeExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.PipeExpr) BinExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.BinExpr) QuantifiedExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.QuantifiedExpr) MulExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.MulExpr) IfExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.IfExpr) XPathExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr) Expr(org.eclipse.wst.xml.xpath2.processor.internal.ast.Expr) MinusExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.MinusExpr) OrExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.OrExpr) TreatAsExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.TreatAsExpr) ForExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.ForExpr) ParExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.ParExpr) FilterExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.FilterExpr) DivExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.DivExpr) CastableExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.CastableExpr) SubExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.SubExpr) PlusExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.PlusExpr) CastExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.CastExpr) AndExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.AndExpr) RangeExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.RangeExpr) StepExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.StepExpr) InstOfExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.InstOfExpr) IntersectExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.IntersectExpr) IDivExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.IDivExpr) UnExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.UnExpr) CntxItemExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.CntxItemExpr) ExceptExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.ExceptExpr) AddExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.AddExpr) UnionExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.UnionExpr) CmpExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.CmpExpr) ModExpr(org.eclipse.wst.xml.xpath2.processor.internal.ast.ModExpr) QName(org.eclipse.wst.xml.xpath2.processor.internal.types.QName) VarExprPair(org.eclipse.wst.xml.xpath2.processor.internal.ast.VarExprPair)

Example 29 with QName

use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.

the class DefaultStaticContext method make_atomic.

/**
 * Creates an atomic from a specific type name initialized with a default
 * value.
 *
 * @param name
 *            name of type to create
 * @return Atomic type of desired type.
 */
public AnyAtomicType make_atomic(QName name) {
    String ns = name.namespace();
    if (!_functions.containsKey(ns))
        return null;
    FunctionLibrary fl = (FunctionLibrary) _functions.get(ns);
    if (!(fl instanceof ConstructorFL))
        return null;
    ConstructorFL cfl = (ConstructorFL) fl;
    return cfl.atomic_type(name);
}
Also used : FnFunctionLibrary(org.eclipse.wst.xml.xpath2.processor.function.FnFunctionLibrary) FunctionLibrary(org.eclipse.wst.xml.xpath2.processor.internal.function.FunctionLibrary) ConstructorFL(org.eclipse.wst.xml.xpath2.processor.internal.function.ConstructorFL)

Example 30 with QName

use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.

the class DefaultStaticContext method debug_print_vars.

/**
 * Debug function which will print current variable scopes and info.
 */
// debug functions
public void debug_print_vars() {
    int level = 0;
    for (Iterator i = _scopes.iterator(); i.hasNext(); ) {
        Map scope = (Map) i.next();
        System.out.println("Scope level " + level);
        // scope.entrySet().iterator();
        for (Iterator j = scope.entrySet().iterator(); j.hasNext(); ) {
            QName varname = (QName) j.next();
            AnyType val = (AnyType) scope.get(varname);
            String string_val = "null";
            if (val != null)
                string_val = val.getStringValue();
            System.out.println("Varname: " + varname.string() + " expanded=" + varname.expanded() + " Value: " + string_val);
        }
        level++;
    }
}
Also used : QName(org.eclipse.wst.xml.xpath2.processor.internal.types.QName) Iterator(java.util.Iterator) HashMap(java.util.HashMap) Map(java.util.Map) AnyType(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)

Aggregations

DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)77 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)77 URL (java.net.URL)76 XSModel (org.apache.xerces.xs.XSModel)76 StaticError (org.eclipse.wst.xml.xpath2.processor.StaticError)76 XPathParserException (org.eclipse.wst.xml.xpath2.processor.XPathParserException)76 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)42 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)21 Iterator (java.util.Iterator)18 Collection (java.util.Collection)17 ArrayList (java.util.ArrayList)13 VarExprPair (org.eclipse.wst.xml.xpath2.processor.internal.ast.VarExprPair)11 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)10 NodeType (org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType)10 ListIterator (java.util.ListIterator)9 XSString (org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)9 XPathExpr (org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)6 TypeDefinition (org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition)5 SeqType (org.eclipse.wst.xml.xpath2.processor.internal.SeqType)5 Schema (javax.xml.validation.Schema)4