This documentation is archived and is not being maintained.

CustomXMLPart.SelectNodes Method

Office 2007
Selects a collection of nodes from a custom XML part.
Aa433524.vs_note(en-us,office.12).gif  Note
References to DTDs from custom XML parts are not supported. DTD references in custom XML parts will not resolve, and custom XML parts containing DTD references generate an exception when an attempt is made to save the file's content to a flat XML file.

Syntax

expression.SelectNodes(XPath)

expression   An expression that returns a CustomXMLPart object.

Parameters

NameRequired/OptionalData TypeDescription
XPathRequiredStringContains the XPath expression.

Return Value
CustomXMLNodes

Example
The following example demonstrates adding a custom XML part, selecting a part matching a namespace URI, and then selecting nodes within that part that match an XPath expression.

Visual Basic for Applications
Dim cxp1 As CustomXMLPart
Dim cxn As CustomXMLNode

' Add a custom xml part.
ActiveDocument.CustomXMLParts.Add "<supplier>"

' Return the first custom xml part with the given namespace.
Set cxp1 = ActiveDocument.CustomXMLParts("urn:invoice:namespace") 

' Get all of the nodes matching an XPath expression.
 Set cxns = cxp1.SelectNodes("//*[@unitPrice > 20]")
				



Show: