XPathMessageFilter.Match 方法

定義

判斷訊息或 XML 文件是否符合 XPath 篩選條件的查詢準則。Determines whether a message or XML document satisfies the query criteria of the XPath filter.

多載

Match(Message)

測試指定的訊息是否符合 XPath 篩選條件的準則。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)

判斷經緩衝處理的訊息是否符合 XPath 篩選條件的查詢準則。Determines whether a buffered message satisfies the query criteria of the XPath filter.

Match(SeekableXPathNavigator)

判斷由已指定最佳化 XPath 導覽所提供的 XML 文件是否符合 XPath 篩選條件的查詢準則。Determines whether the XML document provided by the specified optimized XPath navigator satisfies the query criteria of the XPath filter.

Match(XPathNavigator)

評估已指定 XPath 導覽的篩選。Evaluates the filter over the specified XPath navigator.

備註

這些方法會針對一個篩選條件來檢查訊息。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.

如果您只需要測試訊息標頭而不用測試訊息本文,請使用 Match 方法。If you only need to test the message headers and not the message body, use the Match method.

如果您需要測試訊息本文的部分內容,請使用 Match 方法。If you need to test parts of the message body, use the Match method.

對於包含 XPath 查詢的測試,請使用其中一種剩餘的 Match 多載。For tests that involve XPath queries, use one of the remaining overloads of the Match.

Match(Message)

測試指定的訊息是否符合 XPath 篩選條件的準則。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

參數

message
Message

要測試的 MessageThe Message to test.

傳回

如果 Message 符合篩選條件準則,則為 true,否則為 falsetrue if the Message satisfies the filter criteria; otherwise, false.

例外狀況

messagenullmessage is null.

XPath 評估已嘗試檢查訊息的本文。The XPath evaluation attempted to examine the body of the message.

發生編譯器錯誤。A compiler error occurred.

備註

請使用 XPathMessageFilter.Match 方法來比對本文中的項目。Use the XPathMessageFilter.Match method to match elements from the body. 如果引擎嘗試存取訊息本文以便評估 XPath 運算式,這個方法便會擲回例外狀況。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.

Match(MessageBuffer)

判斷經緩衝處理的訊息是否符合 XPath 篩選條件的查詢準則。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

參數

messageBuffer
MessageBuffer

要測試的 MessageBufferThe MessageBuffer to test.

傳回

如果 Match(MessageBuffer) 符合篩選條件準則,則為 true,否則為 falsetrue if the Match(MessageBuffer) satisfies the filter criteria; otherwise false.

例外狀況

messagenullmessage is null.

發生編譯器錯誤。A compiler error occurred.

備註

如果可以使用 Match,便可使用這個 MessageBuffer 方法多載。Use this overload of the Match method when a MessageBuffer is available. 這種表單可以檢查訊息的本文。This form is allowed to examine the body of the message.

Match(SeekableXPathNavigator)

判斷由已指定最佳化 XPath 導覽所提供的 XML 文件是否符合 XPath 篩選條件的查詢準則。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

參數

navigator
SeekableXPathNavigator

提供測試資料的 SeekableXPathNavigatorThe SeekableXPathNavigator that provides data to test.

傳回

如果來自 SeekableXPathNavigator 的資料符合篩選條件準則,則為 true,否則為 falsetrue if the data from the SeekableXPathNavigator satisfies the filter criteria; otherwise, false.

例外狀況

navigatornullnavigator is null.

發生編譯器錯誤。A compiler error occurred.

備註

SeekableXPathNavigator 類別會以更有效率地執行查詢的方法來擴充 XPathNavigator 類別。The SeekableXPathNavigator class extends the XPathNavigator class with methods that run queries more efficiently.

Match(XPathNavigator)

評估已指定 XPath 導覽的篩選。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

參數

navigator
XPathNavigator

提供測試資料的 XPathNavigatorThe XPathNavigator that provides data to test.

傳回

如果來自 XPathNavigator 的資料符合篩選條件準則,則為 true,否則為 falsetrue if the data from the XPathNavigator satisfies the filter criteria; false otherwise.

例外狀況

navigatornullnavigator is null.

發生編譯器錯誤。A compiler error occurred.

適用於