Szerkesztés

Megosztás a következőn keresztül:


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);
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

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

Match(MessageBuffer)

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

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

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

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);
public bool Match (System.ServiceModel.Dispatcher.SeekableXPathNavigator navigator);
override this.Match : System.ServiceModel.Dispatcher.SeekableXPathNavigator -> bool
Public Function Match (navigator As SeekableXPathNavigator) As Boolean

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

Match(XPathNavigator)

Evaluates the filter over the specified XPath navigator.

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

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