Skip to content

Documentation / @sw-file-lib/xml / xml-schema / DuplicateChildElementCallback

Type Alias: DuplicateChildElementCallback ​

ts
type DuplicateChildElementCallback = (data: DuplicateChildElementData, ctx: SchemaParseContext) => DuplicateChildElementMode;

Defined in: packages/xml/src/xml-schema/parseOptions.ts:98

Callback invoked when multiple child elements are found for a schema field that expects a unique child element.

The callback can inspect the location of the duplicate elements and decide which occurrence should be used, or whether parsing should fail.

Parameters ​

ParameterTypeDescription
dataDuplicateChildElementDataThe duplicated child tag and matching candidate elements.
ctxSchemaParseContextThe location of the element containing the duplicate children.

Returns ​

DuplicateChildElementMode