Package net.sf.saxon.query

Examples of net.sf.saxon.query.StaticQueryContext.buildDocument()


              domDoc = domBuilder.parse(file);
            }
           
            NodeInfo saxonDoc = null;
            if (mode.equals("saxon")) {
              saxonDoc = context.buildDocument(new StreamSource(new ByteArrayInputStream(fileData)));
            }
   
            if (mode.startsWith("fi")) {
              if (mode.indexOf("stax") >= 0) {
//                data = serializeWithStax(doc, staxOutputFactory);
View Full Code Here


                      doc2 = builder.build(new ByteArrayInputStream(fileData), baseURI);
                    } else {
                      doc2 = builder.build(new ByteArrayInputStream(data), baseURI);
                    }
                  } else if (mode.equals("saxon")) { // just for deser comparison
                    context.buildDocument(new StreamSource(new ByteArrayInputStream(fileData)));
                  } else if (mode.equals("dom")) {
                    domDoc = domBuilder.parse(new ByteArrayInputStream(fileData));
  //                  System.err.println(domDoc.getClass().getName());
                  } else if (mode.startsWith("fi") && mode.indexOf("stax") >=0 ) {
                    fistaxMethod.invoke(fistaxReader, new Object[] {new ByteArrayInputStream(data)});
View Full Code Here

        XQueryExpression exp = runtimeConfig.getXQueryExpressionPool().getCompiledExpression(xpath);
        DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        StringReader reader = new StringReader(xml);

        dynamicContext.setContextItem(sqc.buildDocument(new StreamSource(reader)));

        return createListOfXmlNodes(exp, dynamicContext);
    }

    /**
 
View Full Code Here

    public static void exampleToHTMLFile() throws XPathException, IOException {
        final Configuration config = new Configuration();
        final StaticQueryContext sqc = new StaticQueryContext(config);
        final XQueryExpression exp = sqc.compileQuery(new FileReader("query/books-to-html.xq"));
        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);
    }
View Full Code Here

    public static void exampleToHTMLFile() throws XPathException, IOException {
        final Configuration config = new Configuration();
        final StaticQueryContext sqc = new StaticQueryContext(config);
        final XQueryExpression exp = sqc.compileQuery(new FileReader("query/books-to-html.xq"));
        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);
    }
View Full Code Here

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

            }
            StaticQueryContext env = new StaticQueryContext(config);

            Source streamSource = new StreamSource(file);
            long pstart = System.currentTimeMillis();
            DocumentInfo doc = env.buildDocument(streamSource);
            long pend = System.currentTimeMillis();

            System.out.println("  <file name='" + tests[f] +
                    "' size='" + file.length() +
                    "' build-time='" + (pend-pstart) + "'>");
View Full Code Here

            }
            StaticQueryContext env = new StaticQueryContext(config);

            Source streamSource = new StreamSource(file);
            long pstart = System.currentTimeMillis();
            DocumentInfo doc = env.buildDocument(streamSource);
            long pend = System.currentTimeMillis();

            System.out.println("  <file name='" + tests[f] +
                    "' size='" + file.length() +
                    "' schema-aware='" + config.isSchemaAware(Configuration.XSLT) +
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.