testValid: Validate a DDI element.

testValidR Documentation

Validate a DDI element.

Description

Checks parent-specific child occurrences, sequences, choices and mandatory attributes throughout a DDI Codebook element.

Usage

testValid(element, monolang = TRUE)

Arguments

element

A standard element of class "DDI".

monolang

Logical, the codebook file is monolingual

Details

Each existing instance is checked separately, including repeated and recursively nested elements. Required children are checked only when their parent exists. Repeated choices may use different alternatives. An incomplete element can be built incrementally with addChildren(); testValid() also checks the required minimum occurrences and child order.

Validation follows the curated DDI child model. It does not expand imported markup groups or validate all XML datatypes, ID references or mixed text. Use XML Schema validation on exported XML for those additional checks.

To ease the validation of the DDI Codebook XML files, the argument monolang is activated by default. This means a single attribute xmlang in the main codeBook element. For multi-language codebooks, an error is flagged if this argument is missing where appropriate.

Value

A list of class validation, with character vectors mandatory and optional. The latter contains missing required attributes of optional children; both components report validation problems, not recommendations.

Author(s)

Adrian Dusa

See Also

makeElement


DDIwR documentation built on Sept. 13, 2026, 9:06 a.m.

Related to testValid in DDIwR...