U4-4057 - XPathVariable change Value to `object` type?

Created by Lee Kelleher 15 Jan 2014, 16:06:19 Updated by Shannon Deminick 27 Feb 2018, 03:08:53

Subtask of: U4-7997

When using a TypedContentAtXPath() call, we have the option to pass through an array of XPathVariable objects.

However the current codebase for v6.x and v7.0.x has the Value property as type string, whereas this could be set as an object?

This would mean that we could pass in things like XPathNavigator and XPathNodeIterator. e.g. we could pass in a reference to {{$currentPage}}.


Stephan 20 Nov 2014, 14:59:56

Note to self: XPathNavigatorExtensions.Select(...) is feeding the variables into DynamicContext via context.AddVariable(variable.Name, variable.Value) - and that method accepts an object as a value, and the DynamicContext works with objects such as XPathNavigator or XPathNodeIterator. So it's just a matter of changing the XPathVariable.

Stephan 20 Nov 2014, 15:18:32

Note to self: also, we should be clear about what kind of object can be used though, or else ppl will start using things such as DateTime and it will break. See DynamicContent for more details.

Trying to stick with the "no breaking changes on non-major releases" + this is not critical = due in 8.

That being said, the DynamicContext class is public so based upon the (internal) XPathNavigatorExtensions code, it should be possible to re-create what you want as a TypedContentAtXPath(...) extension methods. Far from ideal, I know.

Priority: Normal

Type: Feature (request)

State: Open

Assignee: Stephan

Difficulty: Very Easy

Category: Extensibility

Backwards Compatible: False

Fix Submitted:

Affected versions: 6.2.0, 7.0.2

Due in version:


Story Points: