XPathMessageFilter Class

Represents a query on an XML document defined by an XPath 1.0 expression.

System.Object
  System.ServiceModel.Dispatcher.MessageFilter
    System.ServiceModel.Dispatcher.XPathMessageFilter

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

public class XPathMessageFilter : MessageFilter, 
	IXmlSerializable

The XPathMessageFilter type exposes the following members.

  NameDescription
Public methodXPathMessageFilter()Initializes a new instance of the XPathMessageFilter class that matches all well-formed XML documents.
Public methodXPathMessageFilter(String)Initializes a new instance of the XPathMessageFilter class using an XPath expression to specify query criteria for the filter.
Public methodXPathMessageFilter(XmlReader)Initializes a new instance of the XPathMessageFilter class by reading a streamed XPath with the specified XML reader.
Public methodXPathMessageFilter(String, XmlNamespaceManager)Initializes a new instance of the XPathMessageFilter class using the specified XPath expression and namespace manager.
Public methodXPathMessageFilter(String, XsltContext)Initializes a new instance of the XPathMessageFilter class using a specified XPath expression and XsltContext.
Public methodXPathMessageFilter(XmlReader, XmlNamespaceManager)Initializes a new instance of the XPathMessageFilter class by reading in a streamed XPath with a specified XML reader and using the specified namespace manager.
Public methodXPathMessageFilter(XmlReader, XsltContext)Initializes a new instance of the XPathMessageFilter class by reading a streamed XPath with a specified XML reader and using the XsltContext to resolve namespaces, custom functions, and variables.
Top

  NameDescription
Public propertyNamespacesGets the manager that resolves namespace prefixes in the XPath expression that defines the filter.
Public propertyNodeQuotaGets or sets the maximum number of nodes that should be looked at during filter evaluation.
Public propertyXPathGets the XPath expression that defines the query criteria for the filter.
Top

  NameDescription
Protected methodCreateFilterTable<FilterData>Creates an XPathMessageFilterTable<TFilterData> that has a specified type of data associated with it. (Overrides MessageFilter.CreateFilterTable<FilterData>().)
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 methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodMatch(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. (Overrides MessageFilter.Match(Message).)
Public methodMatch(MessageBuffer)Determines whether a buffered message satisfies the query criteria of the XPath filter. (Overrides MessageFilter.Match(MessageBuffer).)
Public methodMatch(SeekableXPathNavigator)Determines whether the XML document provided by the specified optimized XPath navigator satisfies the query criteria of the XPath filter.
Public methodMatch(XPathNavigator)Evaluates the filter over the specified XPath navigator.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnGetSchemaGets the schema for the current XML document.
Protected methodOnReadXmlReads the current XML node.
Protected methodOnWriteXmlWrites a node using writer.
Protected methodReadXPathInitializes the current instance of the XPathMessageFilter with an XPath obtained from a specified XML reader using a specified namespace manager.
Public methodStatic memberStaticGetSchemaGets the type of XML schema used to serialize the XPath filter.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTrimToSizeCompacts the XPath filter, which releases all unused memory.
Protected methodWriteXPathSerializes the XPath filter to an XmlWriter.
Public methodWriteXPathToWrites the XML XPath element with a specified XML writer.
Top

  NameDescription
Explicit interface implemetationPrivate methodIXmlSerializable.GetSchemaAn explicit interface implementation that gets the current schema.
Explicit interface implemetationPrivate methodIXmlSerializable.ReadXmlAn explicit interface implementation that reads the current XML node.
Explicit interface implemetationPrivate methodIXmlSerializable.WriteXmlAn explicit interface implementation that writes an XML node using writer.
Top

An XPathMessageFilter uses an XPath expression to determine whether an XML document contains specific elements, attributes, text, or other XML syntactic constructs. Typically, an application uses an XPathMessageFilter at an endpoint to query the contents of a SOAP message and then takes the appropriate action based on the results of that query. A queuing process, for example, may use an XPath query to check the priority element of a known header to decide whether to move a message to the front of the queue.

The XML Path Language (XPath) provides a language for addressing parts of an XML document. The primary syntactic construct in XPath is an expression that defines how to traverse the logical structure of an XML document and address or identify an XPath data type. Specifically, XPath implementations evaluate an expression against the structure of an XML document to yield one of the four basic XPath data types: strings, numbers, Booleans, and node sets. They also support functions that convert an XPath data type to a string, number, or Boolean data type. If a method expects one of these three data types, the result of the expression evaluation is implicitly converted. Note that these three data types cannot be converted to a node-set type. The XML Path language is fully described in the W3C XML Path Language 1.0 specification.

Numbers in XPath expressions are expressed as double-precision 64-bit values. Therefore XPath expressions that involve testing numbers with many significant digits can return incorrect results due to floating point precision issues. For more information, seeXML Path Language (XPath) Version 1.0, section 3.5.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft