Esempio n. 1
0
        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
        }
Esempio n. 2
0
        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
        }