Examples of DynamicQueryContext


Examples of net.sf.saxon.query.DynamicQueryContext

        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

Examples of net.sf.saxon.query.DynamicQueryContext

        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

Examples of net.sf.saxon.query.DynamicQueryContext

    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

Examples of net.sf.saxon.query.DynamicQueryContext

        setClosableContainer(connection);
    }

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

Examples of net.sf.saxon.query.DynamicQueryContext

     */

    public void query(PullProvider in, String query, OutputStream out) throws XPathException {
        final StaticQueryContext sqc = config.newStaticQueryContext();
        final XQueryExpression exp = sqc.compileQuery(query);
        final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        dynamicContext.setContextItem(config.buildDocument(new PullSource(in)));
        Properties props = new Properties();
        props.setProperty(OutputKeys.INDENT, "yes");
        exp.run(dynamicContext, new StreamResult(out), props);
    }
View Full Code Here

Examples of net.sf.saxon.query.DynamicQueryContext

     */

    public PullProvider pullQueryResults(NodeInfo source, String query) throws XPathException {
        final StaticQueryContext sqc = config.newStaticQueryContext();
        final XQueryExpression exp = sqc.compileQuery(query);
        final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        dynamicContext.setContextItem(source);
        PullProvider pull = new PullFromIterator(exp.iterator(dynamicContext));
        pull = new PullNamespaceReducer(pull);
        pull.setPipelineConfiguration(config.makePipelineConfiguration());
        return pull;
    }
View Full Code Here

Examples of net.sf.saxon.query.DynamicQueryContext

    public static void exampleToStreamResult() throws XPathException {
        final Configuration config = new Configuration();
        final StaticQueryContext sqc = config.newStaticQueryContext();
        final XQueryExpression exp = sqc.compileQuery("<a b='c'>{5+2}</a>");

        final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        final Properties props = new Properties();
        props.setProperty(OutputKeys.METHOD, "xml");
        props.setProperty(OutputKeys.INDENT, "yes");
        exp.run(dynamicContext, new StreamResult(System.out), props);
    }
View Full Code Here

Examples of net.sf.saxon.query.DynamicQueryContext

    public static void exampleToSingleton() throws XPathException {
        final Configuration config = new Configuration();
        final StaticQueryContext sqc = config.newStaticQueryContext();
        final XQueryExpression exp = sqc.compileQuery("avg(for $i in 1 to 10 return $i*$i)");

        final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        final BigDecimal result = (BigDecimal)exp.evaluateSingle(dynamicContext);
        System.out.println(result);

    }
View Full Code Here

Examples of net.sf.saxon.query.DynamicQueryContext

    public static void exampleToDOM() throws TransformerException {
        final Configuration config = new Configuration();
        final StaticQueryContext sqc = config.newStaticQueryContext();
        final XQueryExpression exp = sqc.compileQuery("<a xmlns='http://a/uri' xmlns:a='another.uri'>text</a>");

        final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        DOMResult result = new DOMResult();
        exp.run(dynamicContext, result, new Properties());

        // now serialize the DOM
View Full Code Here

Examples of net.sf.saxon.query.DynamicQueryContext

    public static void exampleToSequence() throws XPathException {
        final Configuration config = new Configuration();
        final StaticQueryContext sqc = config.newStaticQueryContext();
        final XQueryExpression exp = sqc.compileQuery("for $i in 1 to 10 return ($i * $i)");

        final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        final SequenceIterator iter = exp.iterator(dynamicContext);
        while (true) {
            Item item = iter.next();
            if (item == null) {
                break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.