Project

Profile

Help

Bug #3359

.NET XQuery: Unable to pass an external variable to XQueryEvaluator

Added by O'Neil Delpratt about 4 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Category:
.NET API
Sprint/Milestone:
-
Start date:
2017-07-19
Due date:
% Done:

100%

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

Description

.NET XQuery: Unable to pass an external variable to XQueryEvaluator

See forum post for details: https://saxonica.plan.io/boards/3/topics/6889

A equivalent XdmExternalObject class is missing from .NET.

History

#1 Updated by O'Neil Delpratt about 4 years ago

  • Description updated (diff)

#2 Updated by O'Neil Delpratt about 4 years ago

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

Bug fixed by adding the class XdmExternalObject in the .NET API

#3 Updated by O'Neil Delpratt about 4 years ago

Further, fix made by adding a clause in the XdmValue.Wrap when the value is indeed an ObjectValue which needs wrapping to a XdmExternalObject

#4 Updated by O'Neil Delpratt about 4 years ago

  • Fixed in Maintenance Release 9.7.0.20 added

Bug fix applied in the Saxon 9.7.0.20 maintenance release.

#5 Updated by O'Neil Delpratt about 4 years ago

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

Bug fix applied in the 9.8.0.4 maintenance release.

#6 Updated by Max Toro over 3 years ago

I don't think this issue is fixed. First, I don't see what's the point of having XdmAtomicValue.WrapExternalObject when you can just do new XdmExternalObjectValue(o), but I understand back compat reasons. WrapExternalObject calls XdmValue.Wrap, which returns XdmExternalObjectValue, which is not an XdmAtomicValue, so WrapExternalObject always fails.

Also, WrapExternalObject wraps the argument using DotNetObjectValue, which is then passed to XdmValue.Wrap, which passes the argument to the XdmExternalObjectValue constructor, which wraps the argument again, this time using ObjectValue (not DotNetObjectValue). So, the external object is wrapped twice.

Even if you don't use WrapExternalObject and use XdmExternalObjectValue directly, this has the consequence that when trying to obtain the external object (in an extension function) I call GetExternalObject but get ObjectValue, so I have to call getObject on that. This is because XdmValue.Wrap is used to turn the Sequence into an XdmValue.

I hope you can apply fix to 9.7

#7 Updated by O'Neil Delpratt over 3 years ago

  • Description updated (diff)
  • Status changed from Closed to In Progress

#8 Updated by O'Neil Delpratt over 3 years ago

Hi Max,

Thanks for your comments. The XdmAtomicValue.WrapExternalObject method should be removed because as you have mentioned it just won't work with the new XdmExternalObjectValue class which was introduced.

Likewise the XdmValue.Wrap needs fixing too. This has now been done. Here we unwrap the ObjectValue first before we pass the object as argument to the XdmExternalObjectValue. The Wrap method was designed to create XdmValue from underlying Saxon Sequence objects.

#9 Updated by O'Neil Delpratt over 3 years ago

More nunit tests added

#10 Updated by O'Neil Delpratt over 3 years ago

  • Status changed from In Progress to Resolved
  • Fixed in Maintenance Release deleted (9.7.0.20, 9.8.0.4)

We applied the fix to the 9.7, 9.8 and to the trunk branches

#11 Updated by Debbie Lockett about 3 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. Bug closed even though the patch is pending for 9.7.

Please register to edit this issue

Also available in: Atom PDF