Package net.sf.saxon.query

Examples of net.sf.saxon.query.XQueryExpression.run()


        Properties props = new Properties();
        //props.setProperty(OutputKeys.METHOD, "text");
        props.setProperty(SaxonOutputKeys.WRAP, "no");
        props.setProperty(OutputKeys.INDENT, "no");
        props.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
        exp.run(dynamicContext, new StreamResult(res_sw), props);
        String swresult = sw.toString();
        long used = SystemUtils.getHeapUsedMemory();
        stdbuf.append(", used(before GC): " + StringUtils.displayBytesSize(used));
        if(RUN_ONLY) {
            res_sw.close();
View Full Code Here


        StringWriter res_sw = new StringWriter();
        Properties props = new Properties();
        props.setProperty(SaxonOutputKeys.WRAP, "no");
        props.setProperty(OutputKeys.INDENT, "no");
        props.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
        exp.run(dynamicContext, new StreamResult(res_sw), props);
        return res_sw.toString();
    }

}
View Full Code Here

                        StreamResult result = new StreamResult(outputFileF);
                        try {
                            if (usePull) {
                                xqe.pull(dqc, result, outputProps);
                            } else {
                                xqe.run(dqc, result, outputProps);
                            }
                        } catch (XPathException err) {
                            processError(err, testCase, testName, filePath + queryName + ".xq", expectedErrorNT, specVersionAtt);
                            continue;
                        }
View Full Code Here

                                start = System.currentTimeMillis();
                                exp.pull(context, result, props);
                                end = System.currentTimeMillis();
                            } else {
                                start = System.currentTimeMillis();
                                exp.run(context, result, props);
                                end = System.currentTimeMillis();
                            }
                            runs++;
                            long time = (end - start);
                            if (time < min) min = time;
View Full Code Here

        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);
    }

    /**
     * Build a Saxon "tiny" tree from input supplied via the pull interface
     */
 
View Full Code Here

        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);
    }

    /**
     * Show a query producing a single atomic value as its result and returning the value
     * to the Java application
View Full Code Here

        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

        Transformer identity = TransformerFactory.newInstance().newTransformer();
        identity.transform(new DOMSource(result.getNode()), new StreamResult(System.out));
View Full Code Here

        final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        dynamicContext.setContextItem(config.buildDocument(new StreamSource("data/books.xml")));
        final Properties props = new Properties();
        props.setProperty(OutputKeys.METHOD, "html");
        props.setProperty(OutputKeys.DOCTYPE_PUBLIC, "-//W3C//DTD HTML 4.01 Transitional//EN");
        exp.run(dynamicContext, new StreamResult(new File("booklist.html")), props);
    }

    /**
     * Show a query that takes a parameter (external variable) as input.
     * The query produces a single atomic value as its result and returns the value
View Full Code Here

        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);
    }

    /**
     * Show a query producing a single atomic value as its result and returning the value
     * to the Java application
View Full Code Here

        final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        dynamicContext.setContextNode(sqc.buildDocument(new StreamSource("data/books.xml")));
        final Properties props = new Properties();
        props.setProperty(OutputKeys.METHOD, "html");
        props.setProperty(OutputKeys.DOCTYPE_PUBLIC, "-//W3C//DTD HTML 4.01 Transitional//EN");
        exp.run(dynamicContext, new StreamResult(new File("booklist.html")), props);
    }

    /**
     * Show a query that takes a parameter (external variable) as input.
     * The query produces a single atomic value as its result and returns the value
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.