Returns the string result from evaluating an xpath expression against the given document and context.
// Copyright ? Microsoft Corporation.
// This source file is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
using System;
using System.Text;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;
using System.Diagnostics;
using System.Collections.Generic;
class Util {
public static class BuildComponentUtilities {
/// <summary>
/// Returns the string result from evaluating an xpath expression against the given document and context.
/// </summary>
public static string EvalXPathExpr(IXPathNavigable doc, XPathExpression xpe, CustomContext c) {
XPathExpression t = xpe.Clone();
t.SetContext(c);
return doc.CreateNavigator().Evaluate(t).ToString();
}
}
}
Related examples in the same category