XPathMessageFilter.Match 方法

定义

确定消息或 XML 文档是否满足 XPath 筛选器的查询条件。

重载

Match(Message)

测试指定的消息是否满足 XPath 筛选器的标准。 此格式不允许访问消息的正文。

Match(MessageBuffer)

确定缓冲消息是否满足 XPath 筛选器的查询条件。

Match(SeekableXPathNavigator)

确定由指定的优化 XPath 导航器提供的 XML 文档是否满足 XPath 筛选器的查询条件。

Match(XPathNavigator)

通过指定的 XPath 导航器评估筛选器。

注解

这些方法根据一条消息检查一个筛选器。 如果需要利用多个筛选器检查消息,则请将筛选器放置到筛选器表中,然后使用表提供的匹配方法。

如果只需要测试消息头,而不需要测试消息正文,则请使用 Match 方法。

如果需要测试部分消息正文,请使用 Match 方法。

对于涉及 XPath 查询的测试,请使用 Match 的剩余重载之一。

Match(Message)

测试指定的消息是否满足 XPath 筛选器的标准。 此格式不允许访问消息的正文。

public:
 override bool Match(System::ServiceModel::Channels::Message ^ message);
public override bool Match (System.ServiceModel.Channels.Message message);
override this.Match : System.ServiceModel.Channels.Message -> bool
Public Overrides Function Match (message As Message) As Boolean

参数

message
Message

要测试的 Message

返回

Boolean

如果 Message 满足筛选条件,则为 true;否则为 false

例外

messagenull

XPath 评估尝试检查消息的正文。

发生了编译器错误。

注解

使用 XPathMessageFilter.Match 方法与正文的元素相匹配。 如果引擎尝试访问消息正文以便评估 XPath 表达式,则由此方法引发异常。 这样可帮助确保筛选器引擎不访问正文流。

适用于

Match(MessageBuffer)

确定缓冲消息是否满足 XPath 筛选器的查询条件。

public:
 override bool Match(System::ServiceModel::Channels::MessageBuffer ^ messageBuffer);
public override bool Match (System.ServiceModel.Channels.MessageBuffer messageBuffer);
override this.Match : System.ServiceModel.Channels.MessageBuffer -> bool
Public Overrides Function Match (messageBuffer As MessageBuffer) As Boolean

参数

messageBuffer
MessageBuffer

要测试的 MessageBuffer

返回

Boolean

如果 Match(MessageBuffer) 满足筛选条件,则为 true;否则为 false

例外

messagenull

发生了编译器错误。

注解

Match 为可用时,使用 MessageBuffer 方法的此重载。 此格式允许检查消息的正文。

适用于

Match(SeekableXPathNavigator)

确定由指定的优化 XPath 导航器提供的 XML 文档是否满足 XPath 筛选器的查询条件。

public:
 bool Match(System::ServiceModel::Dispatcher::SeekableXPathNavigator ^ navigator);
public bool Match (System.ServiceModel.Dispatcher.SeekableXPathNavigator navigator);
override this.Match : System.ServiceModel.Dispatcher.SeekableXPathNavigator -> bool
Public Function Match (navigator As SeekableXPathNavigator) As Boolean

参数

navigator
SeekableXPathNavigator

提供要进行测试的数据的 SeekableXPathNavigator

返回

Boolean

如果 true 中的数据满足筛选条件,则为 SeekableXPathNavigator;否则为 false

例外

navigatornull

发生了编译器错误。

注解

SeekableXPathNavigator 类通过更有效的运行查询的方法扩展 XPathNavigator 类。

适用于

Match(XPathNavigator)

通过指定的 XPath 导航器评估筛选器。

public:
 bool Match(System::Xml::XPath::XPathNavigator ^ navigator);
public bool Match (System.Xml.XPath.XPathNavigator navigator);
override this.Match : System.Xml.XPath.XPathNavigator -> bool
Public Function Match (navigator As XPathNavigator) As Boolean

参数

navigator
XPathNavigator

提供要进行测试的数据的 XPathNavigator

返回

Boolean

如果 XPathNavigator 中的数据满足筛选条件,则为 true;否则为 false

例外

navigatornull

发生了编译器错误。

适用于