Table of contents
TOC
Collapse the table of content
Expand the table of content

CustomXMLNode.SelectSingleNode Method (Office)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Selects a single node from a collection matching an XPath expression. This method differs from the CustomXMLPart. SelectSingleNode method in that the XPath expression will be evaluated starting with the 'expression' node as the context node.

Syntax

expression. SelectSingleNode( XPath )

expression An expression that returns a CustomXMLNode object.

Parameters

NameRequired/OptionalData TypeDescription
XPathRequiredStringContains an XPath expression.

Return Value

CustomXMLNode

Remarks

The prefix mappings for the XPath expression are retrieved from the NamespaceManager property.

Example

The following example demonstrates adding a custom XML part, selecting a part with a namespace URI, and then selecting a node within that part that matches an XPath expression.

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 a node using XPath.                              
 Set cxn = cxp1(1).SelectSingleNode("//*[@supplierID = 1]") 

See also

Concepts

CustomXMLNode Object

Other resources

CustomXMLNode Object Members

© 2018 Microsoft