Package org.pdf4j.saxon.expr

Examples of org.pdf4j.saxon.expr.Expression


        }
    }


    public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
        Expression exp = super.optimize(visitor, contextItemType);
        if (exp == this) {
            if (contextItemType.isAtomicType()) {
                return new ContextItemExpression();
            }
        }
View Full Code Here


    * This is a pure function so it can be simplified in advance if the arguments are known
     * @param visitor an expression visitor
     */

    public Expression simplify(ExpressionVisitor visitor) throws XPathException {
        Expression e = simplifyArguments(visitor);
        if (e == this) {
            maybePrecompile(visitor);
        }
        return e;
    }
View Full Code Here

     *          if an error is discovered during this phase
     *          (typically a type error)
     */

    public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
        Expression e = super.optimize(visitor, contextItemType);
        // try once again to compile the regular expression once if possible
        // (used when the regex has been identified as a constant as a result of earlier rewrites)
        if (e == this) {
            maybePrecompile(visitor);
        }
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

        //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

         * Type-check the expression.
         */

        public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
            for (int i=0; i<argument.length; i++) {
                Expression exp = visitor.typeCheck(argument[i], contextItemType);
                if (exp != argument[i]) {
                    adoptChildExpression(exp);
                    argument[i] = exp;
                }
            }
            MemberInfo method = getBestFit(candidateMethods, argument, theClass);
            if (method == null) {
                XPathException err = new XPathException("There is more than one method matching the function call " +
                        getFunctionName().getDisplayName() +
                        ", and there is insufficient type information to determine which one should be used");
                err.setLocator(this);
                throw err;
            } else {
                DotNetExtensionFunctionFactory factory =
                        (DotNetExtensionFunctionFactory)config.getExtensionFunctionFactory("clitype");
                Expression call = factory.makeExtensionFunctionCall(getFunctionName(), theClass, method, argument);
                ExpressionTool.copyLocationInfo(this, call);
                return call;
            }
        }
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

                    } else {
                        compileError("Unknown XSL attribute " + namePool.getDisplayName(anameCode), "XTSE0805");
                    }
                } else {
                    attributeNames[numberOfAttributes] = anameCode;
                    Expression exp = makeAttributeValueTemplate(attributeList.getValue(i));
                    attributeValues[numberOfAttributes] = exp;
                    numberOfAttributes++;
                }
            }
View Full Code Here

                        inheritNamespaces,
                        schemaType,
                        validation);

        inst.setBaseURI(getBaseURI());
        Expression content = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true);

        if (numberOfAttributes > 0) {
            for (int i=attributeNames.length - 1; i>=0; i--) {
                FixedAttribute att = new FixedAttribute(
                        attributeNames[i],
                        Validation.STRIP,
                        null,
                        StandardNames.XS_UNTYPED_ATOMIC);
                try {
                    att.setSelect(attributeValues[i], exec.getConfiguration());
                } catch (XPathException err) {
                    compileError(err);
                }
                att.setLocationId(allocateLocationId(getSystemId(), getLineNumber()));
                Expression exp = att;
                if (getConfiguration().isCompileWithTracing()) {
                    TraceExpression trace = new TraceExpression(exp);
                    trace.setLineNumber(getLineNumber());
                    trace.setColumnNumber(-1);
                    trace.setSystemId(getSystemId());
View Full Code Here

TOP

Related Classes of org.pdf4j.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.