The problem is in using
 
   new Processor(false)
 
In 9.2 the documentation for this method has clarified the way it works:
 
http://www.saxonica.com/documentation/dotnetdoc/Saxon/Api/Processor.html#Processor(bool)
 
The argument needs to be set to true.
 
In the past, with Saxon-SA, schema-awareness was the main feature of the commercial edition of the software, and so "schema-aware" and "licensed edition" were pretty well synonymous. Saxon-EE offers a lot more than schema-awareness, so switches like this have to be more carefully defined.
 
If you set this flag to false, then the Saxon.API dll will load Saxon9 HE instead of Saxon9 EE, and update capability will therefore not be available.
 

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay

 
 


From: Abhisek Bhowmik [mailto:myself.abhisek@gmail.com]
Sent: 12 February 2010 06:16
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Problem in Update using Saxon - URGENT !!

Hi,

I am unable to update a XML using XML Modify. Please find the snippets below.

Saxon Details
Saxon EE 9.2 / Evaluation License (saxon9ee-api.dll, saxon9ee.dll)

.Net Code
try
            {
                 factory = new ConverterFactory();
                 resolver = factory.CreateResolver();
                 processor = new Processor(false); // Create a non schema-aware Processor.
                processor.XmlResolver = resolver;

                XQueryCompiler xqCompiler = processor.NewXQueryCompiler();
                xqCompiler.BaseUri = xqueryUri;
                XQueryEvaluator evaluator;
                using (Stream xqueryStream = File.OpenRead(xqueryPath))
                {
                    xqCompiler.UpdatingEnabled = true;
                    //xqCompiler.XQueryLanguageVersion = "1.1";
                    evaluator = xqCompiler.Compile(xqueryStream).Load();
                }
                evaluator.InputXmlResolver = resolver;
                UriSource source = new UriSource(inputUrl);
                ConvertToXml convToXml = factory.CreateConvertToXml(ediURI);
                {
                    using (XmlReader inputReader = convToXml.GetXmlReader(source))
                    {
                        using (Stream output = new FileStream(outputFile, FileMode.Create, FileAccess.Write, FileShare.None))
                        {
                            Serializer srializer = new Serializer();
                            srializer.SetOutputStream(output);
                            // Setup initial xquery context
                            evaluator.ContextItem = processor.NewDocumentBuilder().Build(inputReader);
                            evaluator.Run(srializer);
                            srializer.Close();
                        }

                    }

                }

            }

The line marked in red throws up exception .

Error Details
XQuery syntax error in #... copy $#:
    Unexpected token "copy" in path expression
if xqCompiler.UpdatingEnabled = true


XQuery Update is supported only in Saxon-EE

Xquery Details
copy
$doc4010 := .
modify (rename node $doc ....


Steps Done
Followed steps for Saxon Installation as in saxonica.com
(places saxon-license.lic in '%SAXON_HOME%/bin' and the application 'bin' folder.


Please Help !!

Thanking in anticipation..



Regards,
Abhisek