XMLNodesCollection interface

Office 2013 and later

Contains a collection of XML Document Object Model (DOM) nodes.

Namespace:  Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly:  Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)

public interface XMLNodesCollection : XMLNodes

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeXMLNodes.

The XMLNodesCollection collection is a general-purpose collection that is used by a number of Microsoft InfoPath methods.

The XMLNodesCollection collection provides properties that can be used to access a collection of XML DOM nodes, and it is returned by both GetSelectedNodes and GetContextNodes methods.

After you have set a reference to one of the XML DOM node objects that the XMLNodesCollection collection contains, you can use any of the properties and methods that the XML DOM provides for interacting with an XML node object.

In the following example, a reference is set to a collection of XML DOM nodes returned by the GetSelectedNodes method of the ViewObject object. Then the code displays the name and source XML of the first node found in the collection using a message box:

XMLNodes selectedNodes;

selectedNodes = thisXDocument.View.GetSelectedNodes();

if (selectedNodes.Count > 0)
 thisXDocument.UI.Alert(selectedNodes[0].nodeName + "\n\n" + selectedNodes[0].text);