/** * AssertionEvaluator (G24 — v1.5.0) * ───────────────────────────────────── * Evaluates xs:assert test="..." XPath 1.0 expressions against XmlElement * nodes. Uses the existing compiled XPath engine. * * Supported test expression forms * ──────────────────────────────── * Attribute comparisons: @attr = 'value' @min <= @max * Numeric comparisons: @count > 0 * String functions: string-length(@name) > 0 contains(@x, 'y') * Existence: @required not(@forbidden) * Child element check: child/grandchild * Boolean AND/OR: @a and @b @a or @b * * Note: xs:assert arithmetic (e.g. @x + @y < 10) requires operator * evaluation not present in the XPath 1.0 subset — such expressions return * true (pass-through) to avoid false-positive errors. * * Usage * ───── * const evaluator = new AssertionEvaluator(element); * const passed = evaluator.evaluate('@min <= @max'); */ import { XmlElement } from '../parser/XmlNodes'; export interface AssertionDefinition { /** XPath 1.0 test expression */ test: string; /** Optional human-readable failure message (from xs:assert/@message) */ message?: string; } export declare class AssertionEvaluator { private element; /** Last expression that fell through to pass-through (for diagnostics) */ lastPassThroughExpr: string | undefined; /** * NP2-08 fix: count of all unsupported/pass-through expressions evaluated. * Callers can check this to detect that the schema has unsupported assertions * rather than relying on the single lastPassThroughExpr string. */ passThroughCount: number; constructor(element: XmlElement); /** * Evaluate a single XPath 1.0 test expression against this element. * Returns true if the assertion passes, false if it fails. * * Supports: * - Attribute presence: @attr * - Attribute equality: @attr = 'value' | @attr != 'value' * - Attribute comparison: @attr <= @other (<=, <, >=, >) * - Numeric attr comparison: @attr > 0 * - Negation: not(@attr) * - Logical AND/OR: @a and @b | @a or @b * - String functions: string-length(@attr) > 0 * contains(@attr, 'x') * starts-with(@attr, 'x') * - Child existence: child ./child * - Self text: . = 'value' */ evaluate(testExpr: string): boolean; private _evalExpr; private _compare; private _getValue; /** * T-08: Get text content of a child identified by a path expression. * Handles single-level and multi-level paths. */ private _getChildText; /** Find a binary operator at the top (non-nested) level of the expression. */ private _findBinaryOp; /** Return the index of the closing paren matching the opening paren at index 0. */ private _matchingParen; } //# sourceMappingURL=AssertionEvaluator.d.ts.map