Package net.sf.saxon.expr

Examples of net.sf.saxon.expr.Expression


        return new SaxonXQExpressionContext(expression);
    }

    public XQSequenceType getStaticResultType() throws XQException {
        checkNotClosed();
        Expression exp = expression.getExpression();    // unwrap two layers!
        ItemType itemType = exp.getItemType(connection.getConfiguration().getTypeHierarchy());
        int cardinality = exp.getCardinality();
        SequenceType staticType = SequenceType.makeSequenceType(itemType, cardinality);
        return new SaxonXQSequenceType(staticType, connection.getConfiguration());
    }
View Full Code Here


            } catch (XPathException err) {
                // fall through to non-optimizing case
            }
        }

        Expression action = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true);
        if (action == null) {
            return null;
        }
        Expression[] conditions = {test};
        Expression[] actions = {action};
View Full Code Here

            for (int i = 0; i < topLevel.size(); i++) {
                NodeInfo node = (NodeInfo) topLevel.get(i);
                if (node instanceof StyleElement) {
                    StyleElement snode = (StyleElement) node;
                    //int module = putModuleNumber(snode.getSystemId());
                    Expression inst = snode.compile(exec);
                    if (inst != null) {
                        inst.setLocationId(allocateLocationId(getSystemId(), snode.getLineNumber()));
                    }
                }
            }

            // Fix up references to the default default decimal format
View Full Code Here

        select = typeCheck("select", select);
        terminate = typeCheck("terminate", terminate);
    }

    public Expression compile(Executable exec) throws XPathException {
        Expression b = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true);
        if (b != null) {
            if (select == null) {
                select = b;
            } else {
                select = Block.makeBlock(select, b);
View Full Code Here

        //checkWithinTemplate();
        test = typeCheck("test", test);
    }

    public Expression compile(Executable exec) throws XPathException {
        Expression action = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true);
        if (action == null) {
            action = Literal.makeEmptySequence();
        }
        While w = new While(test, action);
        return w;
View Full Code Here

            if (select != null) {
                inst.setSelect(
                        makeExpressionVisitor().simplify(new SimpleContentConstructor(select, separator)),
                        exec.getConfiguration());
            } else {
                Expression content = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true);
                inst.setSelect(
                        makeExpressionVisitor().simplify(new SimpleContentConstructor(content, separator)),
                        exec.getConfiguration());
            }
        } catch (XPathException err) {
View Full Code Here

    * @throws XPathException if the syntax of the expression is wrong, or if it references namespaces,
    * variables, or functions that have not been declared.
    */

    public XPathExpression createExpression(String expression) throws XPathException {
        Expression exp = ExpressionTool.make(expression, staticContext, 0, -1, 1, false);
        exp.setContainer(staticContext);
        ExpressionVisitor visitor = ExpressionVisitor.make(staticContext);
        visitor.setExecutable(getExecutable());
        exp = visitor.typeCheck(exp, Type.ITEM_TYPE);
        SlotManager map = staticContext.getStackFrameMap();
        int numberOfExternalVariables = map.getNumberOfVariables();
View Full Code Here

            } else if (f.equals(StandardNames.USE_CHARACTER_MAPS)) {
                useCharacterMapsAtt = Whitespace.trim(atts.getValue(a));
            } else if (fans.contains(f) || f.startsWith("{")) {
                // this is a serialization attribute
                String val = Whitespace.trim(atts.getValue(a));
                Expression exp = makeAttributeValueTemplate(val);
                serializationAttributes.put(nc&0xfffff, exp);
          } else {
            checkUnknownAttribute(nc);
          }
        }
View Full Code Here

        IntIterator it = serializationAttributes.keyIterator();
        while (it.hasNext()) {
            int fp = it.next();
            String displayName = getNamePool().getDisplayName(fp);
            final Expression exp1 = (Expression)serializationAttributes.get(fp);
            final Expression exp2 = typeCheck(displayName, exp1);
            if (exp1 != exp2) {
                serializationAttributes.put(fp, exp2);
            }
        }
View Full Code Here

        boolean needsNamespaceContext = (formatExpression != null);
        NameChecker checker = exec.getConfiguration().getNameChecker();
        NamespaceResolver namespaceResolver = getStaticContext().getNamespaceResolver();
        for (IntIterator it=serializationAttributes.keyIterator(); it.hasNext();) {
            int fp = it.next();
            Expression exp = (Expression)serializationAttributes.get(fp);
            if (exp instanceof StringLiteral) {
                String s = ((StringLiteral)exp).getStringValue();
                String lname = getNamePool().getLocalName(fp);
                String uri = getNamePool().getURI(fp);
                try {

                    ResultDocument.setSerializationProperty(localProps, uri, lname, s,
                            namespaceResolver, false, checker);
                    fixed.add(fp);
                } catch (XPathException e) {
                    if (NamespaceConstant.SAXON.equals(e.getErrorCodeNamespace())) {
                        compileWarning(e.getMessage(), e.getErrorCodeLocalPart());
                    } else {
                        compileError(e);
                    }
                }
            } else {
                String lname = getNamePool().getLocalName(fp);
                if (lname.equals("method") || lname.equals("cdata-section-elements") ||
                        lname.equals("suppress-indentation")) {
                    needsNamespaceContext = true;
                }
            }
        }
        for (IntIterator it=fixed.iterator(); it.hasNext();) {
            serializationAttributes.remove(it.next());
        }

        ResultDocument inst = new ResultDocument(globalProps,
                                              localProps,
                                              href,
                                              formatExpression,
                                              getBaseURI(),
                                              validationAction,
                                              schemaType,
                                              serializationAttributes,
                                              (needsNamespaceContext ? namespaceResolver : null));

        Expression b = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true);
        if (b == null) {
            b = new Literal(EmptySequence.getInstance());
        }
        inst.setContent(b);
        return inst;
View Full Code Here

TOP

Related Classes of net.sf.saxon.expr.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.