PureXML/Sources/Validation
Mihaela Mihaljevic 00c55e642f
perf: make tree-to-tree transforms depth-safe (DTD defaults, canonicalization) (#352)
* perf(model): rebuild DTD-default application iteratively, not recursively

applyingDefaults rebuilt the tree with a per-node recursive walk, so applying
DTD attribute defaults to a deeply-nested document overflowed the stack (around
2000 deep on a Swift Task stack). It now rebuilds bottom-up through a new shared
iterative spine, Node.rebuildingBottomUp, which transforms each node once its
children are rebuilt via an explicit work stack.

The same primitive will carry the other tree-to-tree transforms (canonical
prefix rewrite, XSLT namespace fixup) in follow-ups. Defaults are applied
identically: 1788 tests pass. Part of #350.

* perf(canonical): serialize C14N iteratively, not recursively

Canonicalizer.emit recursed on element children, so canonicalizing a
deeply-nested document overflowed the stack (crashed around 5000 deep).
The element serializer now drives a deferred-close work stack (the same
shape as the main serializer): each step carries the in-scope and
already-rendered namespace context, children push reversed to emit in
document order, and a close step emits the end tag. The shallow document
case and all namespace-rendering logic are unchanged.

The canonical bytes are byte-identical: the C14N 1.0, 1.1, and exclusive
conformance corpora pass, full suite 1789. A 50000-deep document now
canonicalizes without crashing. The node-subset helpers moved to their
own file to keep within the file-length limit. Part of #350.
2026-06-26 19:27:37 +02:00
..
AttributeDeclaration.swift feat(validation): add DTD attribute (ATTLIST) validation 2026-06-08 02:07:01 +02:00
AttributeDefault.swift feat(validation): add DTD attribute (ATTLIST) validation 2026-06-08 02:07:01 +02:00
AttributeListParser.swift feat(dtd): conditional sections, notations, NDATA, external parameter entities 2026-06-08 14:39:42 +02:00
AttributeType.swift feat(dtd): conditional sections, notations, NDATA, external parameter entities 2026-06-08 14:39:42 +02:00
BuiltinValidation.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
Conformance.swift feat(validation): conformance-corpus harness via the validation framework 2026-06-09 19:08:17 +02:00
ContentModel.swift feat(validation): add DTD content-model validation 2026-06-08 01:59:00 +02:00
ContentModelMatcher.swift feat(dtd): located content-model errors with recovery hints 2026-06-09 00:59:25 +02:00
ContentModelParser.swift feat(validation): add DTD content-model validation 2026-06-08 01:59:00 +02:00
DTDDeclarationValidity.swift refactor(validation): located structured validity findings 2026-06-10 10:45:17 +02:00
DTDDefaults.swift perf: make tree-to-tree transforms depth-safe (DTD defaults, canonicalization) (#352) 2026-06-26 19:27:37 +02:00
DTDSchema.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
DTDStandaloneValidity.swift feat(validation): standalone validity constraints and entity WFC 2026-06-10 07:13:30 +02:00
DTDValidationHelpers.swift feat(validation): eduni errata behaviors, 3.3.3 attribute normalization 2026-06-10 07:50:47 +02:00
DTDValidations.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
HasWarnings.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
HTMLValidations.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
Occurrence.swift feat(validation): add DTD content-model validation 2026-06-08 01:59:00 +02:00
Particle.swift feat(validation): add DTD content-model validation 2026-06-08 01:59:00 +02:00
Schematron.swift feat(schema): locate compile diagnostics with validation coding paths (#169) 2026-06-16 10:26:11 +02:00
SchematronModel.swift feat(schematron): support key(), document(), and current() in tests 2026-06-09 03:30:43 +02:00
SchematronParser.swift feat(schematron): support key(), document(), and current() in tests 2026-06-09 03:30:43 +02:00
Severity.swift chore: scaffold PureXML pure-Swift XML package 2026-06-07 23:20:20 +02:00
StreamingDTDValidator.swift feat(validation): streaming DTD ID/IDREF integrity 2026-06-09 10:21:20 +02:00
StructuralValidations.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
Validation.swift feat(validation): composable validation framework + structural rule 2026-06-08 12:00:34 +02:00
ValidationCombinators.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
ValidationCore.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
ValidationOutcome.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
Validator.swift perf(model): make the TreeNode tree type depth-safe (#343) 2026-06-26 16:39:08 +02:00