Xml.Assert

Overview

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

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

Arguments

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:

Example

Simple Usage

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

Copyright © 2010 - 2023 Emakin. All rights reserved.