New-XPathQuery
Last updated
Last updated
The New-XPathQuery
cmdlet create a new query object that can be used to create an XPath expression using [New-XPathExpression], or an element in an XPath query group using . The resulting can be passed as a parameter to . An XPath query object contains the component of an expression that compares an attribute with a value.
For a list of examples filters generated by the XPath cmdlets, see the page.
Required. The name of the attribute to compare
Required. The operator to apply to the attribute
Optional if using the IsPresent or IsNotPresentOperator. Required for all other operators. The value to use in the comparison. This can be any value that can be converted to the data type of the attribute being searched. Reference attributes can also specify another as the search value. See the dereferencing example below.
The New-XPathQuery
does not return a usable query itself. It returns only a part of the query that is used in an XPath expression. You can view the query component itself as shown in the following example.
This returns an string representing the query component
In order to use the query, it must be rendered by an XPath expression created with the [New-XPathExpression] cmdlet
This returns an expression containing the query
You can also use the pipeline to pass the query to the [New-XPathExpression] cmdlet.
The IsPresent and IsNotPresent operators work without the Value
parameter
This returns an expression containing the query
This returns an expression containing the query
Optional. Negates the expression by inverting the comparison operation. For example, using the Negate
switch, the LessThan operator becomes not LessThan. Note that the does not support double negation. Therefore using the Negate
parameter on IsNotPresent and NotEquals operators is not supported.