Export (0) Print
Expand All

XPathMessageContext Class

Defines several XPath functions and namespace mappings commonly used when evaluating XPath expressions against SOAP documents.

System.Object
  System.Xml.XmlNamespaceManager
    System.Xml.Xsl.XsltContext
      System.ServiceModel.Dispatcher.XPathMessageContext

Namespace:  System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

[TypeConverterAttribute(typeof(XPathMessageContextTypeConverter))]
public class XPathMessageContext : XsltContext

The XPathMessageContext type exposes the following members.

  NameDescription
Public methodXPathMessageContext()Creates an instance of XPathMessageContext.
Public methodXPathMessageContext(NameTable)Initializes a new instance of the XPathMessageContext class with the specified NameTable.
Top

  NameDescription
Public propertyDefaultNamespaceGets the namespace URI for the default namespace. (Inherited from XmlNamespaceManager.)
Public propertyNameTableGets the XmlNameTable associated with this object. (Inherited from XmlNamespaceManager.)
Public propertyWhitespaceGets a value that indicates whether to include white space nodes in the output. (Overrides XsltContext.Whitespace.)
Top

  NameDescription
Public methodAddNamespaceAdds the given namespace to the collection. (Inherited from XmlNamespaceManager.)
Public methodCompareDocumentCompares the base Uniform Resource Identifiers (URIs) of two documents based upon the order the documents were loaded by the XSLT processor. (Overrides XsltContext.CompareDocument(String, String).)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetEnumeratorReturns an enumerator to use to iterate through the namespaces in the XmlNamespaceManager. (Inherited from XmlNamespaceManager.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetNamespacesInScopeGets a collection of namespace names keyed by prefix which can be used to enumerate the namespaces currently in scope. (Inherited from XmlNamespaceManager.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodHasNamespaceGets a value indicating whether the supplied prefix has a namespace defined for the current pushed scope. (Inherited from XmlNamespaceManager.)
Public methodLookupNamespaceGets the namespace URI for the specified prefix. (Inherited from XmlNamespaceManager.)
Public methodLookupPrefixFinds the prefix declared for the given namespace URI. (Inherited from XmlNamespaceManager.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodPopScopePops a namespace scope off the stack. (Inherited from XmlNamespaceManager.)
Public methodPreserveWhitespaceEvaluates whether to preserve white space nodes or strip them for the given context. (Overrides XsltContext.PreserveWhitespace(XPathNavigator).)
Public methodPushScopePushes a namespace scope onto the stack. (Inherited from XmlNamespaceManager.)
Public methodRemoveNamespaceRemoves the given namespace for the given prefix. (Inherited from XmlNamespaceManager.)
Public methodResolveFunctionResolves a function reference and returns an T:System.Xml.Xsl.IXsltContextFunction that represents the function. (Overrides XsltContext.ResolveFunction(String, String, XPathResultType[]).)
Public methodResolveVariableResolves a variable reference and returns an IXsltContextVariable that represents the variable. (Overrides XsltContext.ResolveVariable(String, String).)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The XPath engine has full XPath context support and uses the .NET Framework's XsltContext class in the same way that XPathNavigator does to implement this support. XsltContext is an abstract class that allows developers to implement custom XPath function libraries and declare XPath variables. XsltContext is an XmlNamespaceManager and thus also contains the namespace prefix mappings.

The filter engine implements an XsltContext named XPathMessageContext. XPathMessageContext defines custom functions that can be used in XPath expressions and it declares several common namespace prefix mappings. The following table lists the custom functions defined by XPathMessageContext that can be used in XPath expressions.

XPath Function

Description

body

Returns the SOAP Body node, regardless of SOAP version (1.1. or 1.2).

header

Returns the SOAP Header node, regardless of SOAP version (1.1 or 1.2).

correlation-data

Takes an input string and returns the value of the associated correlation message property. 'wsc-instanceId' is a reserved string used for context-based correlation.

messageId

Returns the value of the WS-Addressing MessageID header.

relatesTo

Returns the value of the WS-Addressing RelatesTo header, regardless of version (August2004 or WSA 1.0).

replyTo

Returns the value of the WS-Addressing ReplyTo header, regardless of version (August2004 or WSA 1.0).

from

Returns the value of the WS-Addressing From header, regardless of version (August2004 or WSA 1.0).

faultTo

Returns the value of the WS-Addressing FaultTo header, regardless of version (August2004 or WSA 1.0).

to

Returns the value of the WS-Addressing To header if present, else it returns Anonymous.

action

Returns the value of the WS-Addressing Action header.

soap-uri

Returns the SOAP namespace uri.

headers-with-actor

Takes a SOAP Actor uri and returns all headers that contain that actor, regardless of SOAP version (1.1 or 1.2).

actor

Returns the SOAP Actor uri of the first child node, regardless of SOAP version (1.1 or 1.2).

is-mandatory

Returns whether or not the first child node is mandatory, regardless of SOAP version (1.1 or 1.2).

is-actor-next

Returns whether or not the SOAP Actor uri of the first child node assumes the Next role, regardless of SOAP version (1.1 or 1.2).

is-actor-ultimate-receiver

Returns whether or not the SOAP Actor uri of the first child node assumes the UltimateReceiver role, regardless of SOAP version (1.1 or 1.2).

date-time

Takes an input date string and returns the value converted to a double.

duration

Takes an input timespan string and returns the value as a total number of days.

utc-now

Returns the value of UtcNow.

The following table lists the default namespaces and namespace prefixes that are declared by XPathMessageContext.

Prefix

Namespace

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

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft