Skip to content

Assert

Used for error checks. Makes an assertion that specified xpath returns a true boolean value, otherwise an error is thrown.

1
myXml.Assert(xpath: string, message: string, detail: string):void

Parameters

string xpath
    XPath to be evaluated as a boolean.

string message
    Error message to be shown. If not specified, "Assertion Failed" standard message is used.

string detail
    XPath to evalute to append in the error message.

Remarks

Checking if the Name of a Customer is 'X'. If it is not, message "Invalid customer" will be shown, with appending the real XPath to the Name of a Customer:

Simple Usage

1
$Xml.Assert("//Customer/Name = 'X'", "Invalid customer", "//Customer/Name");