本文整理汇总了C#中XNode.CreateNavigator方法的典型用法代码示例。如果您正苦于以下问题:C# XNode.CreateNavigator方法的具体用法?C# XNode.CreateNavigator怎么用?C# XNode.CreateNavigator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XNode
的用法示例。
在下文中一共展示了XNode.CreateNavigator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectWithRootNamespace
static IEnumerable<XElement> SelectWithRootNamespace(XNode container, string namespaceName, IEnumerable<Traversal> traversals)
{
var nav = container.CreateNavigator();
var xPath = traversals.ToXPath("x");
var manager = new XmlNamespaceManager(nav.NameTable);
manager.AddNamespace("x", namespaceName);
return container.XPathSelectElements(xPath, manager);
}
示例2: VerifyXPathExpressionResults
/// <summary>
/// Verifies that the specified XPath (or more) evaluate to true.
/// </summary>
/// <param name="node">Node to look in.</param>
/// <param name="xpaths">The xpaths to verify.</param>
public static void VerifyXPathExpressionResults(XNode node, object expectedResult, params string[] xpaths)
{
VerifyXPathExpressionResults(node.CreateNavigator(TestNameTable), expectedResult, xpaths);
}
示例3: VerifyXPathExists
/// <summary>
/// Verifies that the specified XPath (or more) return at least one result.
/// </summary>
/// <param name="node">Node to look in.</param>
/// <param name="xpaths">The xpaths to verify.</param>
public static void VerifyXPathExists(AssertionHandler assert, XNode node, params string[] xpaths)
{
VerifyXPathExists(assert, node.CreateNavigator(NameTable), xpaths);
}