PureXML/Sources/Parsing
Mihaela Mihaljevic 78a8b628a5 feat(parsing): in-reader recovery keeps elements and pops to matching tags
Closes #93. Recovery moves into a recovering mode on EventReader, so malformed
input is repaired in place rather than dropped to the next markup boundary:

- A duplicate attribute is recorded and the later occurrence dropped, keeping the
  element. <a id='1' id='2'>y</a> now reads as <a id="1">y</a> with one
  diagnostic (was an empty tree with three).
- A mismatched or unexpected end tag pops the open stack to the matching ancestor,
  implicitly closing the elements nested inside it. <a><b><c>x</b></a> reads as
  <a><b><c>x</c></b></a> with a single diagnostic.
- Pre-root junk reports "unexpected character" instead of the misleading
  "content after the root element".

In recovering mode next() no longer throws: it records a Diagnostic and emits
best-effort events, popping to a match on a mismatch and stopping on truncation
so the builder closes what is open. The strict path is unchanged. readRecovering
becomes a plain non-throwing drain that takes the reader's diagnostics. Recovery
stays deterministic; new tests pin the kept-element and pop-to-match results.
2026-06-08 12:24:43 +02:00
..
ByteDecoder.swift feat(parsing): full encoding support (UTF-32, ISO-8859-1, Windows-1252) 2026-06-08 02:39:25 +02:00
Diagnostic.swift feat(parsing): recovering reader that never crashes on invalid input 2026-06-08 12:15:18 +02:00
DoctypeScanner.swift feat(dtd): external and parameter entities, secure by default 2026-06-08 03:08:20 +02:00
DocumentType.swift feat(dtd): external and parameter entities, secure by default 2026-06-08 03:08:20 +02:00
EntityDecoder.swift feat(parser): optional DTD with internal entities and billion-laughs defense 2026-06-08 01:17:09 +02:00
EntityResolver.swift feat(dtd): external and parameter entities, secure by default 2026-06-08 03:08:20 +02:00
Event.swift
EventReader.swift feat(parsing): in-reader recovery keeps elements and pops to matching tags 2026-06-08 12:24:43 +02:00
ExternalID.swift feat(dtd): external and parameter entities, secure by default 2026-06-08 03:08:20 +02:00
InputEncoding.swift feat(parsing): full encoding support (UTF-32, ISO-8859-1, Windows-1252) 2026-06-08 02:39:25 +02:00
Limits.swift feat(parser): optional DTD with internal entities and billion-laughs defense 2026-06-08 01:17:09 +02:00
Mark.swift
NamespaceContext.swift
ParseError.swift feat(parser): optional DTD with internal entities and billion-laughs defense 2026-06-08 01:17:09 +02:00
Parser.swift feat(parsing): in-reader recovery keeps elements and pops to matching tags 2026-06-08 12:24:43 +02:00
PushAsync.swift feat(parsing): resumable push / feed streaming API 2026-06-08 07:21:22 +02:00
PushParser.swift feat(parsing): resumable push / feed streaming API 2026-06-08 07:21:22 +02:00
PushScanner.swift feat(parsing): resumable push / feed streaming API 2026-06-08 07:21:22 +02:00
Reader.swift feat(parsing): spec-exact XML character classification (chvalid parity) 2026-06-08 02:52:42 +02:00
ReadResult.swift feat(parsing): recovering reader that never crashes on invalid input 2026-06-08 12:15:18 +02:00
SAXHandler.swift feat(parsing): add SAX2 push-callback API 2026-06-08 02:26:04 +02:00
StreamingDecoder.swift feat(parsing): full encoding support (UTF-32, ISO-8859-1, Windows-1252) 2026-06-08 02:39:25 +02:00
TextReader.swift feat(parse): xmlTextReader pull cursor 2026-06-08 03:18:00 +02:00
XMLCharacter.swift feat(parsing): spec-exact XML character classification (chvalid parity) 2026-06-08 02:52:42 +02:00