When the XQUERY_VERSION configuration property is set before installing a
module URI resolver in the configuration, that URI resolver is not propagated
to XQueryCompiler instances based on that configuration.
This may not be the intended behaviour. Or is it?
Some sample code is shown below. It will complain about the module missing,
but can be fixed by omitting setConfigurationProperty, or by explicitly setting
the module URI resolver in the XQueryCompiler (e.g. by getting from the
Best regards,
    public class ImportModule {
      public static void main(String[] args) throws Exception {
        final Configuration configuration = new Configuration();
        configuration.setConfigurationProperty(FeatureKeys.XQUERY_VERSION, "1.0");
        configuration.setModuleURIResolver(new ModuleURIResolver() {
          public StreamSource[] resolve(String moduleURI, String baseURI, String[] locations) throws XPathException {
            StringReader reader = new StringReader("module namespace x='x'; declare variable $x:x := 'x';");
            StreamSource module = new StreamSource(reader);
            return new StreamSource[] {module};
        Processor processor = new Processor(configuration);
        XQueryCompiler xqueryCompiler = processor.newXQueryCompiler();
        xqueryCompiler.setBaseURI(new File(".").toURI());
        XQueryExecutable executable = xqueryCompiler.compile("import module namespace x='x'; $x:x\n");
        executable.load().run(new Serializer(System.out));

Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt, Germany – Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman), Dr. Wolfram Jost, Arnd Zinnhardt; - Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Dr. Andreas Bereczky - http://www.softwareag.com