XPathMessageFilter.Match Method

Definition

Determines whether a message or XML document satisfies the query criteria of the XPath filter.

Overloads

Match(Message)

Tests whether a specified message satisfies the criteria of the XPath filter. This form is not allowed to access the body of the message.

Match(MessageBuffer)

Determines whether a buffered message satisfies the query criteria of the XPath filter.

Match(SeekableXPathNavigator)

Determines whether the XML document provided by the specified optimized XPath navigator satisfies the query criteria of the XPath filter.

Match(XPathNavigator)

Evaluates the filter over the specified XPath navigator.

Remarks

These methods check one filter against a message. If you need to check the message against multiple filters, put the filters into a filter table and then use the match methods provided by the table.

If you only need to test the message headers and not the message body, use the Match method.

If you need to test parts of the message body, use the Match method.

For tests that involve XPath queries, use one of the remaining overloads of the Match.

Match(Message)

Tests whether a specified message satisfies the criteria of the XPath filter. This form is not allowed to access the body of the message.

public override bool Match (System.ServiceModel.Channels.Message message);

Parameters

message
Message

The Message to test.

Returns

true if the Message satisfies the filter criteria; otherwise, false.

Exceptions

message is null.

The XPath evaluation attempted to examine the body of the message.

A compiler error occurred.

Remarks

Use the XPathMessageFilter.Match method to match elements from the body. An exception is thrown by this method if the engine attempts to access the message body in order to evaluate the XPath expression. This helps to ensure that the filter engine does not access the body stream.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Match(MessageBuffer)

Determines whether a buffered message satisfies the query criteria of the XPath filter.

public override bool Match (System.ServiceModel.Channels.MessageBuffer messageBuffer);

Parameters

messageBuffer
MessageBuffer

The MessageBuffer to test.

Returns

true if the Match(MessageBuffer) satisfies the filter criteria; otherwise false.

Exceptions

message is null.

A compiler error occurred.

Remarks

Use this overload of the Match method when a MessageBuffer is available. This form is allowed to examine the body of the message.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Match(SeekableXPathNavigator)

Determines whether the XML document provided by the specified optimized XPath navigator satisfies the query criteria of the XPath filter.

public bool Match (System.ServiceModel.Dispatcher.SeekableXPathNavigator navigator);

Parameters

navigator
SeekableXPathNavigator

The SeekableXPathNavigator that provides data to test.

Returns

true if the data from the SeekableXPathNavigator satisfies the filter criteria; otherwise, false.

Exceptions

navigator is null.

A compiler error occurred.

Remarks

The SeekableXPathNavigator class extends the XPathNavigator class with methods that run queries more efficiently.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Match(XPathNavigator)

Evaluates the filter over the specified XPath navigator.

public bool Match (System.Xml.XPath.XPathNavigator navigator);

Parameters

navigator
XPathNavigator

The XPathNavigator that provides data to test.

Returns

true if the data from the XPathNavigator satisfies the filter criteria; false otherwise.

Exceptions

navigator is null.

A compiler error occurred.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1