Package net.sf.saxon.event

Examples of net.sf.saxon.event.Sink


                                    new File("e:/javalib/xmark/gold1m/q" + q + ".out"));
                        }
                        for (int t=0; t<1000; t++) {

                            dqc.setContextItem(doc);
                            Result result = new Sink();
                            long start, end;
                            start = System.currentTimeMillis();
                            cuq.run(result, props);
                            end = System.currentTimeMillis();

                            runs++;
                            long time = (end - start);
                            if (time < min) min = time;
                            if (time > max) max = time;
                            totalTime += time;
                            if (totalTime > 30000 && t>=2) break;
                        }
                        double avg = ((double)totalTime) / runs;
                        String avgs = format.format(avg);
                        System.out.println("    <query q='" + q +
                                    "' avg='" + avgs +
                                    "' runs='" + runs +
                                    "' min='" + min +
                                    "' max='" + max + "'/>");
                    } catch (XPathException err) {
                        System.err.println("Error in test " + q);
                        System.err.println(err.getMessageAndLocation());
                    }
                }
            } else {

                for (int q=1; q<=20; q++) {
                    if (test != -1 && test != q) {
                        continue;
                    }
                    try {
                        File query = new File(dir + 'q' + q + ".xq");
                        StaticQueryContext qenv = config.newStaticQueryContext();
                        qenv.setBaseURI(query.toURI().toString());
                        if (val) {
                            qenv.getExecutable().setSchemaAware(true);
                        }
                        XQueryExpression exp = qenv.compileQuery(new FileReader(query));
                        int runs = 0;
                        long totalTime = 0;
                        long min = Integer.MAX_VALUE;
                        long max = 0;
                        for (int t=0; t<1000; t++) {
                            final DynamicQueryContext context = new DynamicQueryContext(config);
                            context.setContextItem(doc);
                            Result result = new Sink();
                            long start, end;
                            if (pull) {
                                start = System.currentTimeMillis();
                                exp.pull(context, result, props);
                                end = System.currentTimeMillis();
View Full Code Here


                int runs = 0;
                long totalTime = 0;
                long min = Integer.MAX_VALUE;
                long max = 0;
                for (int t=0; t<10; t++) {
                    Result result = new Sink();
                    long start, end;

                    start = System.currentTimeMillis();
                    templates.newTransformer().transform(doc, result);
                    end = System.currentTimeMillis();
View Full Code Here

    public void validate(PullProvider in) throws XPathException, IOException {
        EnterpriseConfiguration config = new EnterpriseConfiguration();
        in.getPipelineConfiguration().setConfiguration(config);
        in.getPipelineConfiguration().setSchemaURIResolver(config.getSchemaURIResolver());
        Receiver sink = new Sink();
        sink.setPipelineConfiguration(in.getPipelineConfiguration());
        Receiver validator = config.getDocumentValidator(
                sink, in.getSourceLocator().getSystemId(), Validation.STRICT, Whitespace.NONE, null, -1);
        validator.setPipelineConfiguration(in.getPipelineConfiguration());
        //in = new PullTracer(in);
        new PullPushCopier(in, validator).copy();
View Full Code Here

    private Receiver getReceiver(Configuration config, String systemId) throws SaxonApiException {
        PipelineConfiguration pipe = config.makePipelineConfiguration();
        pipe.setExpandAttributeDefaults(expandAttributeDefaults);

        Receiver output = (destination == null ? new Sink() : destination.getReceiver(config));
        output.setPipelineConfiguration(pipe);

        int topLevelElement = -1;
        if (documentElementName != null) {
            topLevelElement = config.getNamePool().allocate(
View Full Code Here

                    long min = Integer.MAX_VALUE;
                    long max = 0;
                    for (int t=0; t<1000; t++) {
                        final DynamicQueryContext context = new DynamicQueryContext(config);
                        context.setContextItem(doc);
                        Result result = new Sink(config.makePipelineConfiguration());
                        long start, end;
                        if (pull) {
                            start = System.currentTimeMillis();
                            exp.pull(context, result, props);
                            end = System.currentTimeMillis();
View Full Code Here

                int runs = 0;
                long totalTime = 0;
                long min = Integer.MAX_VALUE;
                long max = 0;
                for (int t=0; t<10; t++) {
                    Result result = new Sink(config.makePipelineConfiguration());
                    long start, end;

                    start = System.currentTimeMillis();
                    templates.newTransformer().transform(doc, result);
                    end = System.currentTimeMillis();
View Full Code Here

    public void validate(PullProvider in) throws XPathException, IOException {
        EnterpriseConfiguration config = new EnterpriseConfiguration();
        PipelineConfiguration pipe = in.getPipelineConfiguration();
        pipe.setConfiguration(config);
        pipe.setSchemaURIResolver(config.getSchemaURIResolver());
        Receiver sink = new Sink(pipe);
        Receiver validator = config.getDocumentValidator(
                sink, in.getSourceLocator().getSystemId(), Validation.STRICT, Whitespace.NONE, null, -1);
        new PullPushCopier(in, validator).copy();
        System.out.println("Done.");
    }
View Full Code Here

     */

    public void validate(PullProvider in) throws XPathException, IOException {
        SchemaAwareConfiguration config = new SchemaAwareConfiguration();
        in.getPipelineConfiguration().setConfiguration(config);
        Receiver sink = new Sink();
        sink.setPipelineConfiguration(in.getPipelineConfiguration());
        Receiver validator = config.getDocumentValidator(
                sink, in.getSourceLocator().getSystemId(), config.getNamePool(), Validation.STRICT, Whitespace.NONE, null);
        validator.setPipelineConfiguration(in.getPipelineConfiguration());
        //in = new PullTracer(in);
        new PullPushCopier(in, validator).copy();
View Full Code Here

                long min = Integer.MAX_VALUE;
                long max = 0;
                for (int t=0; t<10; t++) {
                    final DynamicQueryContext context = new DynamicQueryContext(config);
                    context.setContextNode(doc);
                    Result result = new Sink();
                    long start, end;
                    if (pull) {
                        start = System.currentTimeMillis();
                        exp.pull(context, result, props);
                        end = System.currentTimeMillis();
View Full Code Here

                int runs = 0;
                long totalTime = 0;
                long min = Integer.MAX_VALUE;
                long max = 0;
                for (int t=0; t<10; t++) {
                    Result result = new Sink();
                    long start, end;

                    start = System.currentTimeMillis();
                    templates.newTransformer().transform(doc, result);
                    end = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of net.sf.saxon.event.Sink

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.