Skip to content

Equals

Returns a boolean value indicating whether the current node has the specified value.

1
myXml.Equals(val: any):boolean

Returns a boolean value indicating whether the specified XPath has the specified value.

1
myXml.Equals(xpath: string, val: any):boolean

Parameters

any val
    Value to compare.

string xpath
    The XPath to evaluate. If not specified, the current node is used.

Returns

true if the node value equals val; otherwise, false.

Remarks

The node's string value is compared with val. Pass strings, for example 'false' rather than false.

The string value of the selected node is compared with val case-sensitively. Pass strings, for example 'false' rather than false; to interpret true/false/1/0 values, use Xml.EvaluateBoolean.

Examples

Compare the value of a selected node

1
var isPen = $Xml.SelectSingle('Lines/Line[1]/Product').Equals('Pen');   // true

Compare a node value

1
2
var isNotApproved = $Xml.Equals('Approved', 'false');        // true
var isJane = $Xml.Equals('Customer/Name', 'jane doe');       // false, the comparison is case-sensitive

See Also