Project

Profile

Help

Bug #3798

closed

.NET API gives "java.lang.UnsupportedOperationException: An array does not have a string value" for XQueryEvaluator.Run method of XQuery returning an array while the Java API with XQueryEvaluator.run works

Added by Martin Honnen over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
.NET API
Sprint/Milestone:
Start date:
2018-05-30
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.8, trunk
Fix Committed on Branch:
9.8, trunk
Fixed in Maintenance Release:
Platforms:

Description

I experience a difference between the Java and the .NET API when using XQueryEvaluator.run/XQueryEvaluator.Run with an XQuery returning an XDM array, a simple test case in C# is

            Processor processor = new Processor(false);
            XQueryCompiler compiler = processor.NewXQueryCompiler();

            string query = "[[1, 2, 3], [4, 5, 6]]";

            XQueryEvaluator evaluator = compiler.Compile(query).Load();

            Serializer serializer = processor.NewSerializer(Console.Out);

            evaluator.Run(serializer);

and unfortunately gives an unhandled exception

Unbehandelte Ausnahme: java.lang.UnsupportedOperationException: An array does not have a string value
   bei net.sf.saxon.ma.arrays.SimpleArrayItem.getStringValueCS()
   bei net.sf.saxon.serialize.UncommittedSerializer.append(Item item, Location locationId, Int32 copyNamespaces)
   bei net.sf.saxon.expr.Expression.process(XPathContext context)
   bei net.sf.saxon.query.XQueryExpression.run(DynamicQueryContext env, Result result, Properties outputProperties)
   bei Saxon.Api.XQueryEvaluator.Run(XmlDestination destination)

(tested with Saxon .NET 9.8.0.12 HE) while the Java transcription

        Processor processor = new Processor(false);
        XQueryCompiler compiler = processor.newXQueryCompiler();

        String query = "[[1, 2, 3], [4, 5, 6]]";

        XQueryEvaluator evaluator = compiler.compile(query).load();

        Serializer serializer = processor.newSerializer(System.out);

        evaluator.run(serializer);

does not give any exception and flattens the array according to the XML output method and outputs

<?xml version="1.0" encoding="UTF-8"?>1 2 3 4 5 6

Is there any reason that the .NET API does not hande this XQuery the same as the Java API?

Does the fix for https://saxonica.plan.io/issues/3578 also fix this .NET issue?

Please register to edit this issue

Also available in: Atom PDF