Skip to content

HasNode

Returns a boolean value indicating whether the specified XPath selects at least one node.

1
myXml.HasNode(xpath: string):boolean

Parameters

string xpath
    The XPath expression to test.

Returns

true if a matching node exists; otherwise, false.

Remarks

Available only in server scripts. Unlike Xml.IsEmpty, this method distinguishes a missing node from a node with an empty value.

Examples

Check optional data before reading it

1
2
3
if ($Xml.HasNode('Customer/Email')) {
    var email = $Xml.Evaluate('Customer/Email');
}

See Also