XPathMessageFilter 类

定义

表示对由 XPath 1.0 表达式定义的 XML 文档的查询。Represents a query on an XML document defined by an XPath 1.0 expression.

public ref class XPathMessageFilter : System::ServiceModel::Dispatcher::MessageFilter, System::Xml::Serialization::IXmlSerializable
public class XPathMessageFilter : System.ServiceModel.Dispatcher.MessageFilter, System.Xml.Serialization.IXmlSerializable
type XPathMessageFilter = class
    inherit MessageFilter
    interface IXmlSerializable
Public Class XPathMessageFilter
Inherits MessageFilter
Implements IXmlSerializable
继承
XPathMessageFilter
实现

注解

XPathMessageFilter 使用 XPath 表达式来确定 XML 文档是否包含特定元素、属性、文本或其他 XML 语法构造。An XPathMessageFilter uses an XPath expression to determine whether an XML document contains specific elements, attributes, text, or other XML syntactic constructs. 通常,应用程序在终结点使用 XPathMessageFilter 来查询 SOAP 消息的内容,然后基于该查询的结果采取适当的操作。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. 例如,排队过程可以使用 XPath 查询来检查已知标头的优先级元素,以决定是否将消息移动到队列的靠前位置。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.

XML Path 语言 (XPath) 提供一种可用于寻找 XML 文档部件的语言。The XML Path Language (XPath) provides a language for addressing parts of an XML document. XPath 中的主要语法构件是表达式,此表达式可定义如何遍历 XML 文档的逻辑结构以及如何寻找或标识 XPath 数据类型。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. 具体地说,XPath 实现评估针对 XML 文档结构地表达式,生成四种基本的 XPath 数据类型之一:字符串、数字、布尔值和节点集合。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. XPath 实现还支持将 XPath 数据类型转换为字符串、数字、或布尔数据类型的功能。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. XML 路径语言在W3C Xml 路径语言1.0 规范中进行了全面说明。The XML Path language is fully described in the W3C XML Path Language 1.0 specification.

XPath 表达式中的数字以双精度 64 位值表示。Numbers in XPath expressions are expressed as double-precision 64-bit values. 因此,含有涉及很多重要数字的测试号码的 XPath 表达式可能由于浮点精度问题,而返回不正确的结果。Therefore XPath expressions that involve testing numbers with many significant digits can return incorrect results due to floating point precision issues. 有关详细信息,请参阅XML 路径语言(XPath)版本1.0,第3.5 节For more information, see XML Path Language (XPath) Version 1.0, section 3.5.

构造函数

XPathMessageFilter()

初始化与所有格式良好的 XML 文档相匹配的 XPathMessageFilter 类的新实例。Initializes a new instance of the XPathMessageFilter class that matches all well-formed XML documents.

XPathMessageFilter(String)

使用 XPath 表达式初始化 XPathMessageFilter 类的一个新实例以指定筛选器的查询条件。Initializes a new instance of the XPathMessageFilter class using an XPath expression to specify query criteria for the filter.

XPathMessageFilter(String, XmlNamespaceManager)

使用指定的 XPath 表达式和命名空间管理器初始化 XPathMessageFilter 类的一个新实例。Initializes a new instance of the XPathMessageFilter class using the specified XPath expression and namespace manager.

XPathMessageFilter(String, XsltContext)

使用指定的 XPath 表达式和 XPathMessageFilter 初始化 XsltContext 类的一个新实例。Initializes a new instance of the XPathMessageFilter class using a specified XPath expression and XsltContext.

XPathMessageFilter(XmlReader)

通过使用指定的 XML 读取器读取流式 XPath 来初始化 XPathMessageFilter 类的一个新实例。Initializes a new instance of the XPathMessageFilter class by reading a streamed XPath with the specified XML reader.

XPathMessageFilter(XmlReader, XmlNamespaceManager)

通过使用指定的 XML 读取器读取流式 XPath 以及使用指定的命名空间管理器来初始化 XPathMessageFilter 类的一个新实例。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.

XPathMessageFilter(XmlReader, XsltContext)

通过使用指定的 XML 读取器读取流式 XPath 以及使用 XPathMessageFilter 解析命名空间、自定义函数和变量来初始化 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.

属性

Namespaces

获取可解析用于定义筛选器的 XPath 表达式中的命名空间前缀的管理器。Gets the manager that resolves namespace prefixes in the XPath expression that defines the filter.

NodeQuota

获取或设置筛选器评估期间应查看的最大节点数。Gets or sets the maximum number of nodes that should be looked at during filter evaluation.

XPath

获取可定义筛选器的查询条件的 XPath 表达式。Gets the XPath expression that defines the query criteria for the filter.

方法

CreateFilterTable<FilterData>()

创建具有与其关联的指定类型的数据的 XPathMessageFilterTable<TFilterData>Creates an XPathMessageFilterTable<TFilterData> that has a specified type of data associated with it.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
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.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnGetSchema()

获取当前 XML 文档的架构。Gets the schema for the current XML document.

OnReadXml(XmlReader)

读取当前 XML 节点。Reads the current XML node.

OnWriteXml(XmlWriter)

使用 writer 编写节点。Writes a node using writer.

ReadXPath(XmlReader, XmlNamespaceManager)

通过使用指定的命名空间管理器从指定的 XML 读取器获得的 XPath 来初始化 XPathMessageFilter 的当前实例。Initializes the current instance of the XPathMessageFilter with an XPath obtained from a specified XML reader using a specified namespace manager.

StaticGetSchema(XmlSchemaSet)

获取用于序列化 XPath 筛选器的 XML 架构的类型。Gets the type of XML schema used to serialize the XPath filter.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)
TrimToSize()

压缩 XPath 筛选器,释放所有未使用的内存。Compacts the XPath filter, which releases all unused memory.

WriteXPath(XmlWriter, IXmlNamespaceResolver)

将 XPath 筛选器序列化到 XmlWriterSerializes the XPath filter to an XmlWriter.

WriteXPathTo(XmlWriter, String, String, String, Boolean)

使用指定的 XML 编写器编写 XML XPath 元素。Writes the XML XPath element with a specified XML writer.

显式界面实现

IXmlSerializable.GetSchema()

获取当前架构的显式接口实现。An explicit interface implementation that gets the current schema.

IXmlSerializable.ReadXml(XmlReader)

读取当前 XML 节点的显式接口实现。An explicit interface implementation that reads the current XML node.

IXmlSerializable.WriteXml(XmlWriter)

使用 writer 编写 XML 节点的显式接口实现。An explicit interface implementation that writes an XML node using writer.

适用于