Package net.sf.saxon

Examples of net.sf.saxon.Configuration$LicenseFeature


            FileNotFoundException, IOException, URISyntaxException {
        URL url = DocumentTableTest.class.getResource(queryFile);
        URI uri = url.toURI();
        String query = IOUtils.toString(url.openStream());

        Configuration config = new Configuration();
        config.setHostLanguage(Configuration.XQUERY);

        StaticQueryContext staticContext = new StaticQueryContext(config);
        staticContext.setBaseURI(uri.toString());
        XQueryExpression exp = staticContext.compileQuery(query);
View Full Code Here


        long free = SystemUtils.getHeapFreeMemory();
        StringBuilder stdbuf = new StringBuilder(256);
        stdbuf.append(" - free(init): " + StringUtils.displayBytesSize(free));
        final StopWatch sw = new StopWatch("[Saxon] " + queryFile);
        queryFile = XMARK_HOME + '/' + queryFile;
        final Configuration config = new Configuration();
        config.setHostLanguage(Configuration.XQUERY);
        final StaticQueryContext staticContext = new StaticQueryContext(config);
        staticContext.setBaseURI(new File(queryFile).toURI().toString());
        XQueryExpression exp = staticContext.compileQuery(IOUtils.toString(new FileInputStream(queryFile)));
        final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        StringWriter res_sw = new StringWriter();
View Full Code Here

        long free = SystemUtils.getHeapFreeMemory();
        StringBuilder stdbuf = new StringBuilder(256);
        stdbuf.append(" - free(init): " + StringUtils.displayBytesSize(free));
        StopWatch sw = new StopWatch("[Saxon] " + queryFile);
        queryFile = XMARK_HOME + '/' + queryFile;
        Configuration config = new Configuration();
        config.setHostLanguage(Configuration.XQUERY);
        StaticQueryContext staticContext = new StaticQueryContext(config);
        staticContext.setBaseURI(new File(queryFile).toURI().toString());
        XQueryExpression exp = staticContext.compileQuery(IOUtils.toString(new FileInputStream(queryFile)));
        DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        StringWriter res_sw = new StringWriter();
View Full Code Here

        proc.execute(module, ser);
        return writer.toString();
    }

    private static String invokeQueryBySaxon(String query) throws XPathException {
        Configuration config = new Configuration();
        config.setHostLanguage(Configuration.XQUERY);
        StaticQueryContext staticContext = new StaticQueryContext(config);
        XQueryExpression exp = staticContext.compileQuery(query);
        DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        StringWriter res_sw = new StringWriter();
        Properties props = new Properties();
View Full Code Here

   
    // saxon
    context = null;
    saxonSerializer = null;
    if (mode.equals("saxon")) {
      context = new StaticQueryContext(new Configuration());
      saxonSerializer = createIdentityTransform(
          new String[] {"net.sf.saxon.TransformerFactoryImpl"});
    }
   
    // DOM
View Full Code Here

     
      // saxon
      StaticQueryContext context = null;
      Transformer saxonSerializer = null;
      if (mode.equals("saxon")) {
        context = new StaticQueryContext(new Configuration());
        String clazz = "net.sf.saxon.TransformerFactoryImpl";
        System.setProperty("javax.xml.transform.TransformerFactory", clazz);
        saxonSerializer = TransformerFactory.newInstance().newTransformer();
      }
     
View Full Code Here

    /**
     * Creates a dynamic context for the given exchange
     */
    protected DynamicQueryContext createDynamicContext(Exchange exchange) throws Exception {
        Configuration config = getConfiguration();
        DynamicQueryContext dynamicQueryContext = new DynamicQueryContext(config);

        Message in = exchange.getIn();
        Source source = null;
        try {
View Full Code Here

        // must use synchronized for concurrency issues and only let it initialize once
        if (!initialized.get()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Initializing XQueryBuilder " + this);
            }
            configuration = new Configuration();
            configuration.setHostLanguage(Configuration.XQUERY);

            staticQueryContext = new StaticQueryContext(getConfiguration());
            Set<Map.Entry<String, String>> entries = namespacePrefixes.entrySet();
            for (Map.Entry<String, String> entry : entries) {
View Full Code Here

    }
   
    this.staticContext = staticContext;
    if (baseURI != null) staticContext.setBaseURI(baseURI.toASCIIString());
   
    final Configuration config = staticContext.getConfiguration();
    if (resolver == null) resolver = new DefaultDocumentURIResolver(config);
    final DocumentURIResolver myResolver = resolver;
    config.setURIResolver(
      new URIResolver() {
        public Source resolve(String href, String baseURI) throws TransformerException {
          try {
            Document doc = myResolver.resolve(href, baseURI);
            if (doc == null) { // fallback to default mechanism
View Full Code Here

    }
  }
 
  /** Creates and returns a default configuration object. */
  private static Configuration createConfiguration() {
    Configuration config = new Configuration();
    config.setHostLanguage(Configuration.XQUERY);
    config.setErrorListener(new DefaultErrorListener());
    config.setAllowExternalFunctions(ALLOW_EXTERNAL_FUNCTIONS);
    if (!SHARE_NAMEPOOLS) config.setNamePool(new NamePool());
//    config.setAllNodesUntyped(true);
//    config.setLazyConstructionMode(true);
//    config.setModuleURIResolver(new DefaultModuleURIResolver());
   
    if (TRACE) {
      /*
       * Caution: XQueryTraceListener is not strictly thread-safe. This is
       * mostly harmless given its current implementation. Nonetheless,
       * it's better not to use tracing in multi-threaded production use;
       * use this only in development/profiling stages.
       */
      config.setTraceListener(new XQueryTraceListener());
      config.setTraceExternalFunctions(true);
//      config.setTiming(true);
    }
   
    return config;
  }
View Full Code Here

TOP

Related Classes of net.sf.saxon.Configuration$LicenseFeature

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.