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 almost 6 years ago. Updated over 5 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?

Actions #1

Updated by Michael Kay almost 6 years ago

  • Assignee set to O'Neil Delpratt
Actions #2

Updated by O'Neil Delpratt almost 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
  • Applies to branch 9.8, trunk added
  • Fix Committed on Branch 9.8, trunk added

The fix from #3578 was not complete. Problem is the output properties being overwritten in the Run method of XQueryEvaluator class.

Bug fixed and committed to subversion.

Actions #3

Updated by Debbie Lockett over 5 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 9.8.0.14 added

Bug fix applied in the Saxon 9.8.0.14 maintenance release.

Please register to edit this issue

Also available in: Atom PDF