Επεξεργασία

Κοινή χρήση μέσω


XPathMessageContext Class

Definition

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

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
Inheritance
XPathMessageContext
Attributes

Remarks

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

Constructors

XPathMessageContext()

Creates an instance of XPathMessageContext.

XPathMessageContext(NameTable)

Initializes a new instance of the XPathMessageContext class with the specified NameTable.

Properties

DefaultNamespace

Gets the namespace URI for the default namespace.

(Inherited from XmlNamespaceManager)
NameTable

Gets the XmlNameTable associated with this object.

(Inherited from XmlNamespaceManager)
Whitespace

Gets a value that indicates whether to include white space nodes in the output.

Methods

AddNamespace(String, String)

Adds the given namespace to the collection.

(Inherited from XmlNamespaceManager)
CompareDocument(String, String)

Compares the base Uniform Resource Identifiers (URIs) of two documents based upon the order the documents were loaded by the XSLT processor.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator()

Returns an enumerator to use to iterate through the namespaces in the XmlNamespaceManager.

(Inherited from XmlNamespaceManager)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNamespacesInScope(XmlNamespaceScope)

Gets a collection of namespace names keyed by prefix which can be used to enumerate the namespaces currently in scope.

(Inherited from XmlNamespaceManager)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
HasNamespace(String)

Gets a value indicating whether the supplied prefix has a namespace defined for the current pushed scope.

(Inherited from XmlNamespaceManager)
LookupNamespace(String)

Gets the namespace URI for the specified prefix.

(Inherited from XmlNamespaceManager)
LookupPrefix(String)

Finds the prefix declared for the given namespace URI.

(Inherited from XmlNamespaceManager)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
PopScope()

Pops a namespace scope off the stack.

(Inherited from XmlNamespaceManager)
PreserveWhitespace(XPathNavigator)

Evaluates whether to preserve white space nodes or strip them for the given context.

PushScope()

Pushes a namespace scope onto the stack.

(Inherited from XmlNamespaceManager)
RemoveNamespace(String, String)

Removes the given namespace for the given prefix.

(Inherited from XmlNamespaceManager)
ResolveFunction(String, String, XPathResultType[])

Resolves a function reference and returns an IXsltContextFunction that represents the function.

ResolveVariable(String, String)

Resolves a variable reference and returns an IXsltContextVariable that represents the variable.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to