XPathMessageContext 類別

定義

定義數個在對 SOAP 文件評估 XPath 運算式時常用的 XPath 函式和命名空間對應。

public ref class XPathMessageContext : System::Xml::Xsl::XsltContext
public class XPathMessageContext : System.Xml.Xsl.XsltContext
[System.ComponentModel.TypeConverter(typeof(System.ServiceModel.XamlIntegration.XPathMessageContextTypeConverter))]
public class XPathMessageContext : System.Xml.Xsl.XsltContext
type XPathMessageContext = class
    inherit XsltContext
[<System.ComponentModel.TypeConverter(typeof(System.ServiceModel.XamlIntegration.XPathMessageContextTypeConverter))>]
type XPathMessageContext = class
    inherit XsltContext
Public Class XPathMessageContext
Inherits XsltContext
繼承
XPathMessageContext
屬性

備註

XPath 引擎提供完整的 XPath 內容支援,並且和 XsltContext 一樣,會使用 .NET Framework 的 XPathNavigator 類別來實作這項支援。 XsltContext 是一個抽象類別,開發人員可以用來實作自訂 XPath 函式程式庫和宣告 XPath 變數。 XsltContextXmlNamespaceManager,因此也會包含命名空間前置詞對應。

篩選引擎會實作名為 XsltContextXPathMessageContextXPathMessageContext 會定義可在 XPath 運算式中使用的自訂函式,並且會宣告數個通用的命名空間前置詞對應。 下表列出可在 XPath 運算式中使用的自訂函 XPathMessageContext 式。

XPath 函式 描述
body 不論 SOAP 版本 (1.1 為何,都會傳回 SOAP 主體節點。或 1.2) 。
header 不論 SOAP 版本 (1.1 或 1.2) 為何,都會傳回 SOAP 標頭節點。
correlation-data 接受輸入字串,並傳回相關聯相互關聯訊息屬性的值。 'wsc-instanceId' 是用於內容型相互關聯的保留字元串。
messageId 傳回WS-Addressing MessageID 標頭的值。
relatesTo 傳回WS-Addressing RelatesTo 標頭的值,不論版本 (2004 年 8 月或 WSA 1.0) 。
replyTo 傳回WS-Addressing ReplyTo 標頭的值,不論版本 (2004 年 8 月或 WSA 1.0) 。
傳回 WS-Addressing From 標頭的值,不論版本 (2004 年 8 月或 WSA 1.0) 。
faultTo 傳回WS-Addressing FaultTo 標頭的值,不論版本 (2004 年 8 月或 WSA 1.0) 。
如果存在,則傳回 WS-Addressing To 標頭的值,否則會傳回 Anonymous。
動作 傳回 WS-Addressing Action 標頭的值。
soap-uri 傳回 SOAP 命名空間 URI。
headers-with-actor 採用 SOAP 動作專案 URI,並傳回包含該動作專案的所有標頭,不論 SOAP 版本 (1.1 或 1.2) 。
actor 傳回第一個子節點的 SOAP 動作專案 URI,不論 SOAP 版本 (1.1 或 1.2) 。
is-mandatory 傳回不論 SOAP 版本 (1.1 或 1.2) 為何,第一個子節點是否為必要。
is-actor-next 不論 SOAP 版本 (1.1 或 1.2) ,第一個子節點的 SOAP 動作專案 URI 是否假設下一個角色。
is-actor-ultimate-receiver 傳回第一個子節點的 SOAP 動作專案 URI 是否假設 UltimateReceiver 角色,不論 SOAP 版本 (1.1 或 1.2) 。
date-time 接受輸入日期字串,並傳回轉換成 double 的值。
duration 接受輸入時間範圍字串,並將值傳回為總天數。
utc-now 傳回 的值 UtcNow

下表列出 由 XPathMessageContext 宣告的預設命名空間和命名空間前置詞。

前置詞 命名空間
s11 http://schemas.xmlsoap.org/soap/envelope
s12 http://www.w3.org/2003/05/soap-envelope
wsaAugust2004 http://schemas.xmlsoap.org/ws/2004/08/addressing
wsa10 http://www.w3.org/2005/08/addressing
sm http://schemas.microsoft.com/serviceModel/2004/05/xpathfunctions
tempuri http://tempuri.org
ser http://schemas.microsoft.com/2003/10/Serialization

建構函式

XPathMessageContext()

建立 XPathMessageContext 的執行個體。

XPathMessageContext(NameTable)

使用指定的 XPathMessageContext 初始化 NameTable 類別的新執行個體。

屬性

DefaultNamespace

取得預設命名空間的命名空間 URI。

(繼承來源 XmlNamespaceManager)
NameTable

取得與這個物件相關聯的 XmlNameTable

(繼承來源 XmlNamespaceManager)
Whitespace

取得值,這個值會指出是否要在輸出中包含空白區 (White Space) 節點。

方法

AddNamespace(String, String)

將指定的命名空間加入集合中。

(繼承來源 XmlNamespaceManager)
CompareDocument(String, String)

根據 XSLT 處理器載入兩個文件的順序,比較它們的基底統一資源識別元 (URI)。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetEnumerator()

傳回用於逐一查看 XmlNamespaceManager 中命名空間的列舉值。

(繼承來源 XmlNamespaceManager)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetNamespacesInScope(XmlNamespaceScope)

取得命名空間名稱集合,會根據前置詞索引,可用於列舉目前在範圍中的命名空間。

(繼承來源 XmlNamespaceManager)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
HasNamespace(String)

取得值,表示提供的前置詞是否具有針對目前推送的範圍中定義的命名空間。

(繼承來源 XmlNamespaceManager)
LookupNamespace(String)

取得指定前置詞的命名空間 URI。

(繼承來源 XmlNamespaceManager)
LookupPrefix(String)

尋找為指定命名空間 URI 宣告的前置詞。

(繼承來源 XmlNamespaceManager)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
PopScope()

將命名空間範圍自堆疊取出。

(繼承來源 XmlNamespaceManager)
PreserveWhitespace(XPathNavigator)

評估指定的內容是否要保留或刪除空白區節點。

PushScope()

將命名空間範圍推送至堆疊。

(繼承來源 XmlNamespaceManager)
RemoveNamespace(String, String)

移除指定前置詞的指定命名空間。

(繼承來源 XmlNamespaceManager)
ResolveFunction(String, String, XPathResultType[])

解析函式參考並傳回表示函式的 IXsltContextFunction

ResolveVariable(String, String)

解析變數參考並傳回表示變數的 IXsltContextVariable

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於