BuildComponentUtilitiesEvalXPathExpr(IXPathNavigable, XPathExpression, String) Method

This is used to get the string result from evaluating an XPath expression against the given document and a context created from a set of key/value pairs.

Definition

Namespace: Sandcastle.Core.BuildAssembler
Assembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2024.12.21.0
public static string EvalXPathExpr(
	this IXPathNavigable document,
	XPathExpression expression,
	params string[] keyValuePairs
)

Parameters

document  IXPathNavigable
The document to use
expression  XPathExpression
The XPath expression to evaluate
keyValuePairs  String
A set of key/value pairs to use when creating the context

Return Value

String
The evaluated expression result

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IXPathNavigable. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Example

C#
string result = document.EvalXPathExpr("concat($key, '.htm')", "key", "filename");

Exceptions

ArgumentExceptionThis is thrown if the keyValuePairs parameter contains an odd number of parameters.

See Also