Xml EvaluateBoolean Returns the boolean value of the current node.
myXml.EvaluateBoolean():boolean
Returns the boolean value of the node selected by the specified XPath expression.
myXml.EvaluateBoolean(xpath: string):boolean
Parameters string xpath The XPath expression to evaluate. If not specified, the current node is used.
Returns (): The boolean value of the current node. (xpath): The boolean value of the selected node. This method checks whether the evaluated value is, case-insensitively, equal to "false", "0", or an empty value. All other values are evaluated as true.
Examples Read the boolean value of a selected node var approved = $Xml . SelectSingle ( 'Approved' ). EvaluateBoolean (); // false
Branch on a boolean value if ( ! $Xml . EvaluateBoolean ( 'Approved' )) {
throw new Error ( 'Order ' + $Xml . Evaluate ( 'Id' ) + ' is not approved.' );
}
Evaluate an XPath condition var hasBulkLine = $Xml . EvaluateBoolean ( 'count(Lines/Line[Quantity > 1]) > 0' ); // true
See Also