Share via


CustomXMLParts.SelectByNamespace Method

Office Developer Reference

Selects the collection of custom XML parts whose namespace matches the search criteria.

Aa433527.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.SelectByNamespace(NamespaceURI)

expression   An expression that returns a CustomXMLParts object.

Parameters

Name Required/Optional Data Type Description
NamespaceURI Required String Contains a namespace URI.

Return Value
CustomXMLParts

Remarks

If no custom XML parts with this namespace exist, the method returns an empty CustomXMLParts collection object.

Example

The following example selects all of the custom XML parts matching the namespace and then selects a node from those parts that match an XPath expression.

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

' Returns all of the custom xml parts with the given namespace. Set cxp1 = ActiveDocument.CustomXMLParts.SelectByNamespace("urn:invoice:namespace")

' Get the node matching the XPath expression.
Set cxn = cxp1(1).SelectSingleNode("//*[@supplierID = 1]")

See Also