Package org.pdf4j.saxon.query

Examples of org.pdf4j.saxon.query.DynamicQueryContext


    public static SequenceIterator query(XPathContext context, XQueryExpression query)
            throws XPathException {
        if (query == null) {
            return null;
        }
        DynamicQueryContext dqc = new DynamicQueryContext(context.getConfiguration());
        Item c = context.getContextItem();
        if (c != null) {
            dqc.setContextItem(c);
        }
        return query.iterator(dqc);
    }
View Full Code Here


    public static SequenceIterator query(XPathContext context, XQueryExpression query, Item source)
            throws XPathException {
        if (query == null) {
            return null;
        }
        DynamicQueryContext dqc = new DynamicQueryContext(context.getConfiguration());
        if (source != null) {
            dqc.setContextItem(source);
        }
        return query.iterator(dqc);
    }
View Full Code Here

    public static SequenceIterator query(XPathContext context, XQueryExpression query,
                                         Item source, SequenceIterator params) throws XPathException {
        if (query == null) {
            return null;
        }
        DynamicQueryContext dqc = new DynamicQueryContext(context.getConfiguration());
        if (source != null) {
            dqc.setContextItem(source);
        }
        NamePool pool = context.getConfiguration().getNamePool();
        while (true) {
            Item param = params.next();
            if (param == null) {
                break;
            }
            if (param instanceof NodeInfo) {
                switch (((NodeInfo)param).getNodeKind()) {
                case Type.ELEMENT:
                case Type.ATTRIBUTE:
                    Value val = ((NodeInfo)param).atomize();
                    dqc.setParameter(pool.getClarkName(((NodeInfo)param).getNameCode()), val);
                    break;
                case Type.DOCUMENT:
                    AxisIterator kids = ((NodeInfo)param).iterateAxis(Axis.CHILD, NodeKindTest.ELEMENT);
                    while (true) {
                        NodeInfo kid = (NodeInfo)kids.next();
                        if (kid == null) {
                            break;
                        }
                        Value val2 = ((NodeInfo)param).atomize();
                        dqc.setParameter(pool.getClarkName(kid.getNameCode()), val2);
                    }
                    break;
                default:
                    throw new XPathException(
                            "Parameters passed to saxon:query() must be element, attribute, or document nodes");
View Full Code Here

     */

    protected XQueryEvaluator(Processor processor, XQueryExpression expression) {
        this.processor = processor;
        this.expression = expression;
        this.context = new DynamicQueryContext(expression.getExecutable().getConfiguration());
    }
View Full Code Here

        checkNotClosed();
        try {
            SaxonXQStaticContext xqStaticContext = ((SaxonXQStaticContext)properties);
            StaticQueryContext sqc = xqStaticContext.getSaxonStaticQueryContext();
            XQueryExpression exp = sqc.compileQuery(xquery, null);
            DynamicQueryContext dqc = new DynamicQueryContext(config);
            return new SaxonXQPreparedExpression(this, exp, xqStaticContext, dqc);
        } catch (XPathException e) {
            throw newXQException(e);
        } catch (IOException e) {
            throw newXQException(e);
View Full Code Here

        checkNotClosed();
        try {
            SaxonXQStaticContext xqStaticContext = ((SaxonXQStaticContext)properties);
            StaticQueryContext sqc = xqStaticContext.getSaxonStaticQueryContext();
            XQueryExpression exp = sqc.compileQuery(xquery);
            DynamicQueryContext dqc = new DynamicQueryContext(config);
            return new SaxonXQPreparedExpression(this, exp, xqStaticContext, dqc);
        } catch (XPathException e) {
            throw newXQException(e);
        } catch (IOException e) {
            throw newXQException(e);
View Full Code Here

        checkNotClosed();
        try {
            SaxonXQStaticContext xqStaticContext = ((SaxonXQStaticContext)properties);
            StaticQueryContext sqc = xqStaticContext.getSaxonStaticQueryContext();
            XQueryExpression exp = sqc.compileQuery(xquery);
            DynamicQueryContext dqc = new DynamicQueryContext(config);
            return new SaxonXQPreparedExpression(this, exp, xqStaticContext, dqc);
        } catch (XPathException e) {
            throw newXQException(e);
        } catch (NullPointerException e) {
            throw newXQException(e);
View Full Code Here

        XQueryExpression xqe = ((SaxonXQPreparedExpression)expression).getXQueryExpression();
        if (xqe.getExecutable().getConfiguration() != config) {
            throw new IllegalArgumentException("Supplied expression must derive from the same XQDataSource");
        }
        SaxonXQStaticContext sqc = ((SaxonXQPreparedExpression)expression).getSaxonXQStaticContext();
        DynamicQueryContext dqc = new DynamicQueryContext(config);
        return new SaxonXQPreparedExpression(this, xqe, sqc, dqc);
    }
View Full Code Here

    DynamicQueryContext context;
    boolean closed;

    SaxonXQExpression(SaxonXQConnection connection) throws XQException {
        this.connection = connection;
        context = new DynamicQueryContext(connection.getConfiguration());
        sqc = (SaxonXQStaticContext)connection.getStaticContext();
        setClosableContainer(connection);
    }
View Full Code Here

        setClosableContainer(connection);
    }

    SaxonXQExpression(SaxonXQConnection connection, SaxonXQStaticContext staticContext) {
        this.connection = connection;
        context = new DynamicQueryContext(connection.getConfiguration());
        sqc = staticContext;
        setClosableContainer(connection);
    }
View Full Code Here

TOP

Related Classes of org.pdf4j.saxon.query.DynamicQueryContext

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.