Expand description
DTD validation (§27, §85 Phase 6).
DTD validation against element/attribute declarations:
- Element content model validation — does the element’s child sequence match its declared content model?
- Attribute value validation — does each attribute’s value conform to its declared type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, ENUMERATION, NOTATION)?
- ID/IDREF consistency — are all ID values unique? Does each IDREF reference a valid ID?
- Required attributes — are all REQUIRED attributes present?
- NOTATION validation — are NOTATION attributes referencing declared notations?
- Well-formedness constraints — additional validity constraints
§UPSTREAM-PARITY
This module follows libxml2’s valid.c implementation. The validation
context (xmlValidCtxt) accumulates ID/IDREF tables across the document
and checks consistency in xmlValidateDocumentFinal.
§Phase 6 status
Complete — all core DTD validation functions are implemented. Edge-case behavior for degenerate DTDs matches upstream.
Functions§
- free_
valid_ ⚠ctxt - Free a validation context.
- is_
empty_ ⚠element - Check if an element is declared as EMPTY.
- is_
mixed_ ⚠element - Check if an element has a mixed content model.
- new_
valid_ ⚠ctxt - Create a new validation context.
- set_
valid_ ⚠errors - Set error and warning callbacks on a validation context.
- validate_
attribute_ ⚠decl - Validate an attribute’s value against its declaration.
- validate_
attribute_ ⚠value - Validate an attribute value against its declared type.
- validate_
content ⚠ - Validate the content of an element node against its content model.
- validate_
document ⚠ - Validate an entire document against its DTD.
- validate_
document_ ⚠final - Final validation: check that all IDREFs resolve to existing IDs.
- validate_
dtd ⚠ - Validate a DTD’s declarations (element/attribute declarations).
- validate_
dtd_ ⚠final - Final DTD validation — checks ID/IDREF consistency.
- validate_
element ⚠ - Validate a single element node against its DTD element and attribute declarations.
- validate_
enumeration ⚠ - Validate that
valueis one of the values in the enumeration. - validate_
id ⚠ - Validate an ID value: check that the value is a valid XML Name and that no duplicate ID values exist in the document.
- validate_
id_ ⚠ref - Validate an IDREF value: check that the referenced ID exists in the document.
- validate_
id_ ⚠refs - Validate IDREFS (whitespace-separated list of IDREF values).
- validate_
name ⚠ - Validate whether
valueis a valid XML Name. - validate_
names ⚠ - Validate whether
valueis a whitespace-separated list of XML Names. - validate_
nmtoken ⚠ - Validate whether
valueis a valid XML NMTOKEN. - validate_
nmtokens ⚠ - Validate whether
valueis a whitespace-separated list of XML NMTOKENs. - validate_
notation_ ⚠use - Validate that
notationNameis a declared notation in the document’s DTD. - validate_
root ⚠ - Validate the root element of a document.