AttributeMatchPath

 

发布日期: 2016年11月

适用于: Dynamics 365 (online),Dynamics 365 (on-premises),Dynamics CRM 2013,Dynamics CRM 2015,Dynamics CRM 2016

Web 控件配置可使用 <AttributeMatchPath> 元素在当前使用控件属性加载的 HTML 文档中查找所需的控件。 “匹配路径”是通过 HTMLDocument Object Model (DOM) 的每个元素循环应用的关键值/值对的排序列表,与匹配路径上的节点属性进行匹配。 每个关键值表示要匹配的属性的名称,并且值与 HTML 文档中分派的属性值匹配。 在关键键/值匹配后,按顺序使用下一个关键值/值对以与 DOM 中的每个元素进行比较。 请注意,如果 keyn+1 = keyn,将以 DOM 中的下一个元素节点开始,而不是当前节点与新关键键/值对进行匹配。

在本主题中

<AttributeMatchPath> 语法

<AttributeMatchPath> 元素

<AttributeMatchPath> 语法

<AttributeMatchPath> 元素面向 HTML 应用程序内的特定框架创建。

<AttributeMatchPath [framename=""|framesrc=""] [framematch="n"] [matchtype="equals|startswith|endswith|contains"]>

<attributeName1 [matchtype= "equals|startswith|endswith|contains"]>
attributeValueToMatch1
</attributeName1>

<attributeName2 [matchtype= "equals|startswith|endswith|contains"]>
attributeValueToMatch2
</attributeName2>

…
<attributeNamen [matchtype= "equals|startswith|endswith|contains"]>
attributeValueToMatchn
</attributeNamen>

</AttributeMatchPath>

<AttributeMatchPath> 元素

下表描述了 <AttributeMatchPath> 的元素

元素

说明

Framename

与 IFrame 的框架名称匹配。

Framesrc

与 IFrame 的源框架匹配。

Framematch

与 nth 的一个指定框架匹配;默认值为 1

Matchtype

指定标题应如何进行匹配。 可能的值为 equalsstartswithendswithcontains;所有其他值都将引发异常。

例如,如果 Web 应用程序有一个以上的框架拥有一个给定名称,可以指定搜索第二个或第三个该名称框架。framematch 属性不是必需的,但是,假设其为 1,除非另外指定。 如果指定 framematch,则必须指定 framenameframesrc;否则,将会引发“找不到框架”异常。

备注

如果未提供任何 AttributeMatchPath 属性,该操作将会如同框架一样在顶级窗口发生。 如果 framenameframesrc 均指定,则 framesrc 具有优先权。

在以下示例中,对 attributeValueToMatch 使用 matchtype

<AttributeMatchPath>
<key1>val1</key1>
<key2>val2</key2>
<key3[matchtype="equals|startswith|endswith|contains"]>attributeValueToMatch</key3>
  .
<keyn>valn</keyn>
</AttributeMatchPath>

以下示例显示了 Test 标记的完整属性匹配路径。

Page code:  
<Test FirstName='John' LastName='Smith'/>

Match path used in control description:  
<AttributeMatchPath>
<FirstName>John</FirstName>
<LastName>Smith</LastName>
</AttributeMatchPath>

备注

强烈建议您只使用 ID 和/或名称作为搜索属性。 其他属性将会对性能有负面影响。

另请参阅

WebDDA
使用数据驱动适配器 (DDA)

Unified Service Desk 2.0

© 2017 Microsoft。 保留所有权利。 版权