編輯

共用方式為


XMLNodesCollection Interface

Definition

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

public interface class XMLNodesCollection : Microsoft::Office::Interop::InfoPath::XMLNodes
[System.Runtime.InteropServices.Guid("096CD6C1-0786-11D1-95FA-0080C78EE3BB")]
public interface XMLNodesCollection : Microsoft.Office.Interop.InfoPath.XMLNodes
type XMLNodesCollection = interface
    interface XMLNodes
Public Interface XMLNodesCollection
Implements XMLNodes
Derived
Attributes
Implements

Examples

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:

<span class="label">XMLNodes</span> selectedNodes;

selectedNodes = thisXDocument.View.GetSelectedNodes();

if (selectedNodes.Count &gt; 0)
{
 thisXDocument.UI.Alert(selectedNodes[0].nodeName + "\n\n" + selectedNodes[0].text);
}

Remarks

This type is a wrapper for a COM interface implemented by a coclass that is required by managed code for COM interoperability. To access the members specified by this interface, use the type that wraps the coclass that implements this interface. For information about that type, including usage, remarks, and examples, seeXMLNodes.

The XMLNodesCollection collection is a general-purpose collection that is used by a number of Microsoft Office InfoPath 2003 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(Object, Object) 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.

Properties

Count

Gets a count of the number of XML Document Object Model (DOM) node objects contained in the XMLNodesCollection collection.

(Inherited from XMLNodes)
Item[Object]

Gets a reference to the specified XML Document Object Model (DOM) node from the XMLNodesCollection collection.

(Inherited from XMLNodes)

Methods

GetEnumerator()

Gets an IEnumerator that iterates over all entries in the XMLNodesCollection object.

(Inherited from XMLNodes)

Applies to