XMLNodesCollection 接口

包含由 XML 文档对象模型 (DOM) 节点组成的集合。

命名空间:  Microsoft.Office.Interop.InfoPath.SemiTrust
程序集:  Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)

语法

声明
<GuidAttribute("096cd6c1-0786-11d1-95fa-0080c78ee3bb")> _
Public Interface XMLNodesCollection _
    Inherits XMLNodes
用法
Dim instance As XMLNodesCollection
[GuidAttribute("096cd6c1-0786-11d1-95fa-0080c78ee3bb")]
public interface XMLNodesCollection : XMLNodes

备注

此类型是用于 Coclass(托管代码需要此 Coclass 来实现 COM 互操作性)的包装。使用此类型来访问由此 Coclass 实现的 COM 接口。有关 COM 接口的信息(包括指向其成员说明的链接),请参阅XMLNodes.

XMLNodesCollection 集合是由许多 Microsoft InfoPath 方法所使用的通用集合。

XMLNodesCollection 集合可用于访问 XML DOM 节点集合的属性,它由 GetSelectedNodesGetContextNodes 方法返回。

在设置了对 XMLNodesCollection 集合包含的某个 XML DOM 节点对象的引用之后,可以使用 XML DOM 所提供的用于与 XML 节点进行交互的任何属性和方法。

示例

在下面的示例中,设置了一个对 XML DOM 节点集合(由 ViewObject 对象的 GetSelectedNodes 方法返回)的引用。然后代码使用消息框显示在集合中找到的第一个节点的名称和源 XML:

XMLNodes selectedNodes;

selectedNodes = thisXDocument.View.GetSelectedNodes();

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

另请参阅

引用

XMLNodesCollection 成员

Microsoft.Office.Interop.InfoPath.SemiTrust 命名空间