本文整理汇总了C#中Aspose.Words.Document.SelectSingleNode方法的典型用法代码示例。如果您正苦于以下问题:C# Document.SelectSingleNode方法的具体用法?C# Document.SelectSingleNode怎么用?C# Document.SelectSingleNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aspose.Words.Document
的用法示例。
在下文中一共展示了Document.SelectSingleNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompositeNode_SelectNodes
public void CompositeNode_SelectNodes()
{
//ExStart
//ExFor:CompositeNode.SelectSingleNode
//ExFor:CompositeNode.SelectNodes
//ExSummary:Shows how to select certain nodes by using an XPath expression.
Aspose.Words.Document doc = new Aspose.Words.Document(MyDir + "Table.Document.doc");
// This expression will extract all paragraph nodes which are descendants of any table node in the document.
// This will return any paragraphs which are in a table.
NodeList nodeList = doc.SelectNodes("//Table//Paragraph");
// This expression will select any paragraphs that are direct children of any body node in the document.
nodeList = doc.SelectNodes("//Body/Paragraph");
// Use SelectSingleNode to select the first result of the same expression as above.
Aspose.Words.Node node = doc.SelectSingleNode("//Body/Paragraph");
//ExEnd
}