We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

The difference between SelectNodes and GetChildNodes methods

Hello Aspose,

What’s the difference between document.SelectNodes("//FieldStart") and document.GetChildNodes(NodeType.FieldStart, true) methods?

Thank you in advance,


Thanks for your inquiry. Both methods return the collection of nodes. The CompositeNode.SelectNodes method selects a list of nodes matching the XPath expression. This method returns the object of NodeList class that represents a collection of nodes matching an XPath query. Please check the following code snippet.

// 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");

The CompositeNode.GetChildNodes method returns a live collection of child nodes that match the specified type.

We suggest you please read about Aspose.Words’ documnt object model from here:
Aspose.Words Document Object Model