PureXML/Sources
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
..
Canonical perf: make tree-to-tree transforms depth-safe (DTD defaults, canonicalization) (#352) 2026-06-26 19:27:37 +02:00
Catalog feat(catalog): honor group-level prefer override 2026-06-08 18:05:03 +02:00
Emitting perf(serialize): scan bytes, not graphemes, to find characters to escape (#297) 2026-06-25 15:39:20 +02:00
HTML fix(html): percent-escape non-ASCII characters in URI-valued attributes (closes output32) (#263) 2026-06-24 03:27:49 +02:00
Model perf: make tree-to-tree transforms depth-safe (DTD defaults, canonicalization) (#352) 2026-06-26 19:27:37 +02:00
Parsing perf(parsing): resolve namespaces in O(1), making parse linear in depth (#346) 2026-06-26 17:44:27 +02:00
Pattern feat(pattern): streaming xmlPattern matching 2026-06-08 05:49:13 +02:00
Regex docs(schema): disclose the contested-corpus basis for rejecting unescaped [ (#250) 2026-06-23 03:34:38 +02:00
Schema refactor: remove three more dead functions (#331) 2026-06-26 12:41:34 +02:00
Stream chore: scaffold PureXML pure-Swift XML package 2026-06-07 23:20:20 +02:00
Validation perf: make tree-to-tree transforms depth-safe (DTD defaults, canonicalization) (#352) 2026-06-26 19:27:37 +02:00
XInclude feat(xinclude): range inclusion via XPointer range model (#87) 2026-06-09 04:19:38 +02:00
XPath perf(xpath): share value-Node projections across a result set (#349) 2026-06-26 18:43:27 +02:00
XPointer perf(xpointer): linear-time string-range() search (#314) 2026-06-26 04:01:41 +02:00
XSLT refactor: remove three more dead functions (#331) 2026-06-26 12:41:34 +02:00
API.swift perf(parse): build the TreeNode tree directly from the event stream (#295) 2026-06-25 14:15:57 +02:00
Lint.swift feat(editor): unified lint surface merging parse and validation diagnostics 2026-06-08 13:18:29 +02:00
PureXML.swift feat(html): lenient HTML parser and serializer 2026-06-08 07:12:42 +02:00
QuickFix.swift feat(editor): structured quick-fixes from completions 2026-06-08 13:35:33 +02:00