예제 #1
0
        /**
         * Construct a local default environment for a test set
         */

        public static Environment createLocalEnvironment(Uri baseURI, int generateByteCode, bool unfolded, Spec spec)
        {
            Environment environment = new Environment();

            environment.processor = new Processor(true);
            //AutoActivate.activate(environment.processor);
            if (generateByteCode == 1)
            {
                environment.processor.SetProperty(JFeatureKeys.GENERATE_BYTE_CODE, "true");
                environment.processor.SetProperty(JFeatureKeys.DEBUG_BYTE_CODE, "false");
            }
            else if (generateByteCode == 2)
            {
                environment.processor.SetProperty(JFeatureKeys.GENERATE_BYTE_CODE, "true");
                environment.processor.SetProperty(JFeatureKeys.DEBUG_BYTE_CODE, "true");
                //environment.processor.SetProperty(JFeatureKeys.DEBUG_BYTE_CODE_DIR, "debugByteCode");
            }
            else
            {
                environment.processor.SetProperty(JFeatureKeys.GENERATE_BYTE_CODE, "false");
                environment.processor.SetProperty(JFeatureKeys.DEBUG_BYTE_CODE, "false");
            }
            //environment.processor.SetProperty(JFeatureKeys.TRACE_EXTERNAL_FUNCTIONS, "true");
            environment.xpathCompiler          = environment.processor.NewXPathCompiler();
            environment.xpathCompiler.BaseUri  = baseURI.ToString(); //TODO: Check that this is OK
            environment.xqueryCompiler         = environment.processor.NewXQueryCompiler();
            environment.xqueryCompiler.BaseUri = baseURI.AbsolutePath;
            environment.xsltCompiler           = environment.processor.NewXsltCompiler();
            environment.xsltCompiler.BaseUri   = new Uri(baseURI.ToString());
            if (spec.Equals(Spec.XT30))
            {
                environment.xsltCompiler.XsltLanguageVersion = "3.0";
            }
            else
            {
                environment.xsltCompiler.XsltLanguageVersion = "2.0";
            }
            if (unfolded)
            {
                // environment.xqueryCompiler.Implementation.setCodeInjector(new LazyLiteralInjector()); //TODO
            }
            environment.processor.Implementation.setDefaultCollection(null);
            return(environment);
        }
예제 #2
0
 /// <summary>
 /// Tests if this integer constant equals another integer constant,
 /// both in terms of value and spec.
 /// </summary>
 /// <param name="other">An integer constant.</param>
 /// <returns>
 /// <c>true</c> if the integer constants are equal; otherwise, <c>false</c>.
 /// </returns>
 public bool Equals(IntegerConstant other)
 {
     return(Value.Equals(other.Value) && Spec.Equals(other.Spec));
 }