Project

Profile

Help

RE: StaticContext.Processor in SaxonCS ExtensionFunctionC... » Example1FunctionCall.cs

Martin Honnen, 2022-08-16 09:07

 
using Saxon.Api;

namespace SaxonCSExtensionStaticContextTestLib
{
public class Example1FunctionCall : ExtensionFunctionCall
{

Processor processor;
public override XdmValue Call(XdmValue[] arguments, DynamicContext context)
{
string inputString = arguments[0][0].StringValue;

return processor.NewDocumentBuilder().Build(new StringReader(inputString));
}

public override void CopyLocalData(ExtensionFunctionCall destination)
{
base.CopyLocalData(destination);
var castedDestination = (Example1FunctionCall)destination;
castedDestination.processor = processor;
}

public override void SupplyStaticContext(StaticContext context)
{
base.SupplyStaticContext(context);
processor = context.Processor;
}
}
}
(2-2/2)