XPathMessageFilter Constructors

Definition

Initializes a new instance of the XPathMessageFilter class.

Overloads

XPathMessageFilter()

Initializes a new instance of the XPathMessageFilter class that matches all well-formed XML documents.

XPathMessageFilter(String)

Initializes a new instance of the XPathMessageFilter class using an XPath expression to specify query criteria for the filter.

XPathMessageFilter(XmlReader)

Initializes a new instance of the XPathMessageFilter class by reading a streamed XPath with the specified XML reader.

XPathMessageFilter(String, XmlNamespaceManager)

Initializes a new instance of the XPathMessageFilter class using the specified XPath expression and namespace manager.

XPathMessageFilter(String, XsltContext)

Initializes a new instance of the XPathMessageFilter class using a specified XPath expression and XsltContext.

XPathMessageFilter(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.

XPathMessageFilter(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.

XPathMessageFilter()

Initializes a new instance of the XPathMessageFilter class that matches all well-formed XML documents.

public XPathMessageFilter ();

Remarks

Initializes a new instance of the XPathMessageFilter class with an empty XPath expression. An empty XPath expression always matches a well-formed XML document, so all objects satisfy the criteria of a filter defined by an empty XPath expression.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

XPathMessageFilter(String)

Initializes a new instance of the XPathMessageFilter class using an XPath expression to specify query criteria for the filter.

public XPathMessageFilter (string xpath);

Parameters

xpath
String

A String that contains an XPath 1.0 expression.

Exceptions

xpath is null.

Remarks

Use this constructor when there are no namespaces to manage.

This constructor initializes the XmlNamespaceManager assigned to the Namespaces property by using the default XPathMessageContext, so the XPath expression has access to the function library that the XPathMessageContext defines.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

XPathMessageFilter(XmlReader)

Initializes a new instance of the XPathMessageFilter class by reading a streamed XPath with the specified XML reader.

public XPathMessageFilter (System.Xml.XmlReader reader);

Parameters

reader
XmlReader

The XmlReader to read the streamed XPath expression.

Exceptions

reader is null.

Remarks

It is assumed that the reader is positioned at the start element of the serialized XPathMessageFilter. The name of the element is not validated before reading. When this method returns, the reader is positioned immediately after the serialized XPathMessageFilter. The constructor also automatically initializes the namespace manager by resolving all prefixes in the XPath expression as they were bound in the reader.

This method can access any XML that can be created by the WriteXPathTo method.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

XPathMessageFilter(String, XmlNamespaceManager)

Initializes a new instance of the XPathMessageFilter class using the specified XPath expression and namespace manager.

public XPathMessageFilter (string xpath, System.Xml.XmlNamespaceManager namespaces);

Parameters

xpath
String

An XPath 1.0 expression.

namespaces
XmlNamespaceManager

An XmlNamespaceManager that resolves any namespace prefixes in xpath.

Exceptions

xpath is null.

Remarks

Use this constructor when XPath uses prefixes not defined in XPathMessageContext, or when you want to use your own XmlNamespaceManager. An instance of XPathMessageContext can be created and passed to this method.

If the instances provided to this method are XsltContext implementations, it is equivalent to calling the XPathMessageFilter constructor.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

XPathMessageFilter(String, XsltContext)

Initializes a new instance of the XPathMessageFilter class using a specified XPath expression and XsltContext.

public XPathMessageFilter (string xpath, System.Xml.Xsl.XsltContext context);

Parameters

xpath
String

The XPath 1.0 expression for the filter.

context
XsltContext

An XsltContext that resolves any namespace prefixes, custom functions or variables in xpath.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

XPathMessageFilter(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 XPathMessageFilter (System.Xml.XmlReader reader, System.Xml.XmlNamespaceManager namespaces);

Parameters

reader
XmlReader

The XmlReader to read the streamed XPath expression.

namespaces
XmlNamespaceManager

An XmlNamespaceManager that resolves any namespace prefixes in the XPath expression from reader. This can also be an XsltContext that defines custom functions or variables.

Exceptions

reader is null.

reader is not positioned on the starting element.

There were problems reading the dialect attribute or namespace URI, or duplicate attributes were found.

-or-

An invalid dialect attribute was read: it was not XPath.

Remarks

Use this constructor when you want to use your own XmlReader and XmlNamespaceManager to define the filter.

It is assumed that the reader is positioned at the start element of the serialized XPathMessageFilter. The name of the element is not validated before reading. When this method returns, the reader is positioned immediately after the serialized XPathMessageFilter.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

XPathMessageFilter(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.

public XPathMessageFilter (System.Xml.XmlReader reader, System.Xml.Xsl.XsltContext context);

Parameters

reader
XmlReader

The XmlReader to read the streamed XPath expression.

context
XsltContext

An XsltContext that resolves any namespace prefixes, functions, and variables in the XPath expression from reader.

Exceptions

reader is null.

Remarks

Use this constructor when you want to use your own XmlReader and XmlNamespaceManager to define the filter.

It is assumed that the reader is positioned at the start element of the serialized XPathMessageFilter. The name of the element is not validated before reading. When this method returns, the reader is positioned immediately after the serialized XPathMessageFilter.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1