Interface ElementRule<T>

A rule definition for a single element.

interface ElementRule<T> {
    __invariant?: Invariant<T>;
    localPart: undefined | string;
    namespaceUri: Maybe<string>;
    required: boolean;
    rules: XmlRules<NonNullable<T>>;
    type: ELEMENT;
}

Type Parameters

  • T extends object | undefined

Hierarchy

Properties

__invariant?: Invariant<T>

Prevents rule from losing nullable type information.

localPart: undefined | string

Matches the QName.localPart of the element. If undefined, this will match against the property name from XmlRules.

namespaceUri: Maybe<string>

Matches the namespaceUri of the element or attribute.

If null, this will only match against a null namespace. If undefined, this will default to the namespace of the parent element for elements, or null for attributes.

Note that attributes do not inherit default namespaces as elements do.

required: boolean

If true, a parsing error will be thrown if the value is undefined.

rules: XmlRules<NonNullable<T>>

Returns the schema for the matched element.

type: ELEMENT