Saxon.Api

 

 

Saxon.Api

Class Step<TInput, TResult>


public class Step<TInput, TResult>

A Step class wraps a delegate method that can be applied to an item to return a XdmValue of items.

Constructor Summary

Step (Func<TInput, IEnumerable<TResult>> steppingFunction)

Constructor method to wrap a delegate method.

 

Property Summary

  Func

The Func property that represents the wrapped delegate method which can be invoked.

 

Method Summary

 Step<TInput, TResult> At (int index)

Obtain a Step that selects the Nth item in the results of this step.

 Step<TInput, TResult> Cat (Step<TInput, TResult> other)

Obtain a Step that concatenates the results of this Step with the result of another Step applied to the same input item.

 IEnumerable<TResult> Invoke (TInput item)

Invokes this function to the given argument.

 Step<TInput, TResult> Then (Step<TResult, TResult> next)

Obtain a Step that combines the results of this step with the results of another step.

 Step<TInput, TResult> Where (Predicate<TResult> predicate)

Obtain a Step that filters the results of this Step using a supplied Func predicate.

For example, Child.Where(Predicate.IsText()) returns a Step whose effect is to select the text node children of a supplied element or document node.

 

Constructor Detail

Step

public Step(Func<TInput, IEnumerable<TResult>> steppingFunction)

Constructor method to wrap a delegate method.

Parameters:

steppingFunction - Passes a delegate as a Func with encapsulated type XdmItem and the return value IEnumerable of items.

Property Detail

Func

public  Func {get; }

The Func property that represents the wrapped delegate method which can be invoked.

Method Detail

At

public Step<TInput, TResult> At(int index)

Obtain a Step that selects the Nth item in the results of this step.

Parameters:

index - The zero-based index of the item to be selected

Returns:

A new Step (that is, a function from one IEnumerable of items to another) that filters the results of this step by selecting only the items that satisfy the predicate.

Cat

public Step<TInput, TResult> Cat(Step<TInput, TResult> other)

Obtain a Step that concatenates the results of this Step with the result of another Step applied to the same input item.

For example, Attribute().Cat(Child()) returns a step whose effect is to select the attributes of a supplied element followed by its children.

Parameters:

other - The step whose results will be concatenated with the results of this step

Returns:

A new Step (that is, a function from one IEnumerable of items to another) that concatenates the results of applying this step to the input item, followed by the results of applying the other step to the input item.

Invoke

public IEnumerable<TResult> Invoke(TInput item)

Invokes this function to the given argument.

Parameters:

item - The function argument

Returns:

The function result.

Then

public Step<TInput, TResult> Then(Step<TResult, TResult> next)

Obtain a Step that combines the results of this step with the results of another step.

Parameters:

next - The step which will be applied to the results of this step

Returns:

A new Step (that is, a function from one IEnumerable of items to another) that performs this step and the next step in turn. The result is equivalent to the IEnumerable method SelectMany() function or the XPath ! operator: there is no sorting of nodes into document order, and no elimination of duplicates.

Where

public Step<TInput, TResult> Where(Predicate<TResult> predicate)

Obtain a Step that filters the results of this Step using a supplied Func predicate.

For example, Child.Where(Predicate.IsText()) returns a Step whose effect is to select the text node children of a supplied element or document node.

Parameters:

predicate - The predicate is a Func delegate encapsulating the filter which will be applied to the results of this Step

Returns:

A new Step (that is, a wrapped delegate from one Step of items to another) that filters the results of this step by selecting only the items that satisfy the predicate.