Show / Hide Table of Contents

Class DomExpressionEvaluator

Implementation of IEvaluatesDomValueExpression which evaluates DOM expressions returning an object that contains a list of nodes and supplemental information.

Inheritance
System.Object
DomExpressionEvaluator
Implements
IEvaluatesDomValueExpression
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ZptSharp.Tal
Assembly: ZptSharp.dll
Syntax
public class DomExpressionEvaluator : IEvaluatesDomValueExpression

Constructors

| Improve this Doc View Source

DomExpressionEvaluator(IEvaluatesExpression, IInterpretsExpressionResult, ILogger<DomExpressionEvaluator>)

Initializes a new instance of the DomExpressionEvaluator class.

Declaration
public DomExpressionEvaluator(IEvaluatesExpression evaluator, IInterpretsExpressionResult resultInterpreter, ILogger<DomExpressionEvaluator> logger)
Parameters
Type Name Description
IEvaluatesExpression evaluator

Evaluator.

IInterpretsExpressionResult resultInterpreter

Result interpreter.

Microsoft.Extensions.Logging.ILogger<DomExpressionEvaluator> logger

A logger.

Methods

| Improve this Doc View Source

EvaluateExpressionAsync(String, ExpressionContext, CancellationToken)

Evaluates the expression asynchronously and returns the result.

Declaration
public Task<DomValueExpressionResult> EvaluateExpressionAsync(string expression, ExpressionContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String expression

An expression which might be prefixed to indicate that it is to be treated as structure.

ExpressionContext context

Context.

System.Threading.CancellationToken cancellationToken

Cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<DomValueExpressionResult>

The expression result.

Remarks

This method also deals with the differentiation between structure and text expressions. Structure expressions are inserted directly into the DOM without escaping or encoding. Text expressions are treated explicitly as text and are encoded/escaped to ensure that they are not accidentally treated as markup.

Expressions are treated as text by default. An expression is only treated as structure if:

  • It is prefixed by a keyword structure and a single space, for example structure myExpression
  • The expression result implements IGetsStructuredMarkup and the expression is NOT prefixed by the keyword text and a single space, for example text myExpression

Apart from aborting the treatment of IGetsStructuredMarkup as structure, the text prefix keyword for expressions is redundant, as it is the default. It is supported though, for situations where you wish to be explicit.

Implements

IEvaluatesDomValueExpression
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX