PureXML/Sources/Parsing
Mihaela Mihaljevic 3405c9709d
perf(parsing): resolve namespaces in O(1), making parse linear in depth (#346)
Each open element resolved its name and attributes by looking up namespace
bindings through NamespaceContext.lookup, which walked a stack of scopes as
deep as the document. With one lookup per element over an O(depth) stack,
parsing a deeply-nested document was O(depth^2): a 40000-deep document took
~39s.

The context now maintains the current in-scope bindings incrementally: a
single prefix-to-URI map, plus a per-element undo list recording the
bindings each element overwrote so closing it restores the enclosing state.
A lookup is O(1) and entering/leaving an element is O(its xmlns
declarations), so parsing is O(n). The same document now parses in ~0.2s.

Namespace semantics are unchanged: the nearest in-scope binding still wins,
an empty default binding still undeclares, and 81 namespace tests plus the
full suite (1784) pass. Closes #345.
2026-06-26 17:44:27 +02:00
..
Big5Decoder.swift
Big5Table1.swift
Big5Table2.swift
Big5Table3.swift
Big5Table4.swift
Big5Table5.swift
Big5Table6.swift
Big5Table.swift
ByteDecoder.swift feat(parsing): fatal encoding-declaration contradictions, E38 version rule 2026-06-10 08:16:08 +02:00
ByteEncoder.swift
ByteStorage.swift perf(parsing): byte-backed Reader and bulk content runs 2026-06-10 18:48:57 +02:00
CharacterClassification.swift perf(parsing): byte-level scanning fast paths halve parse time vs libxml2 (#275) 2026-06-24 18:46:58 +02:00
CJKByteEncoder.swift
Diagnostic.swift feat(parsing): Namespaces 1.0 constraint enforcement 2026-06-10 08:06:45 +02:00
DoctypeScanner.swift refactor: remove three dead file-scoped functions (#330) 2026-06-26 12:04:07 +02:00
DoctypeScannerConditional.swift refactor(validation): located structured validity findings 2026-06-10 10:45:17 +02:00
DoctypeScannerEntities.swift refactor(validation): located structured validity findings 2026-06-10 10:45:17 +02:00
DoctypeScannerStrict.swift refactor(validation): located structured validity findings 2026-06-10 10:45:17 +02:00
DocumentType.swift refactor(validation): located structured validity findings 2026-06-10 10:45:17 +02:00
DTDAttListGrammar.swift feat(parsing): scalar-level lexing, xmlconf archive fully conformant 2026-06-10 08:40:26 +02:00
DTDContentModelGrammar.swift feat(parsing): scalar-level lexing, xmlconf archive fully conformant 2026-06-10 08:40:26 +02:00
EntityDecoder.swift perf(parsing): linearize entity-graph checks for billion-laughs (#342) 2026-06-26 15:30:51 +02:00
EntityReplacementGrammar.swift feat(parsing): scalar-level lexing, xmlconf archive fully conformant 2026-06-10 08:40:26 +02:00
EntityResolver.swift
EUCJPDecoder.swift
EUCKRDecoder.swift
EUCKRTable1.swift
EUCKRTable2.swift
EUCKRTable3.swift
EUCKRTable4.swift
EUCKRTable5.swift
EUCKRTable6.swift
EUCTWDecoder.swift refactor(parsing): drop slice copies; document the expansion bounds 2026-06-10 04:01:16 +02:00
EUCTWPlane11.swift feat(parsing): EUC-TW (CNS 11643) decoding, closing #108 2026-06-09 17:44:22 +02:00
EUCTWPlane12.swift feat(parsing): EUC-TW (CNS 11643) decoding, closing #108 2026-06-09 17:44:22 +02:00
EUCTWPlane13.swift feat(parsing): EUC-TW (CNS 11643) decoding, closing #108 2026-06-09 17:44:22 +02:00
EUCTWPlane21.swift feat(parsing): EUC-TW (CNS 11643) decoding, closing #108 2026-06-09 17:44:22 +02:00
EUCTWPlane22.swift feat(parsing): EUC-TW (CNS 11643) decoding, closing #108 2026-06-09 17:44:22 +02:00
EUCTWPlane23.swift feat(parsing): EUC-TW (CNS 11643) decoding, closing #108 2026-06-09 17:44:22 +02:00
EUCTWTable.swift feat(parsing): EUC-TW (CNS 11643) decoding, closing #108 2026-06-09 17:44:22 +02:00
Event.swift
EventReader.swift perf(parse): split the name prefix from a scanned colon offset (#292) 2026-06-25 12:23:53 +02:00
EventReaderAttributes.swift perf(parsing): skip reference decoding for ampersand-free attribute values (#278) 2026-06-25 00:17:31 +02:00
EventReaderContent.swift perf(parsing): dispatch element-content markup on the byte after '<' (#276) 2026-06-24 19:25:10 +02:00
EventReaderEndTag.swift feat(xpath,parsing): public streaming surface, linear document-order at scale 2026-06-11 06:06:31 +02:00
EventReaderRecovery.swift feat(parsing): fourth W3C-suite strictness pass, declaration grammar 2026-06-10 05:34:11 +02:00
EventReaderValidity.swift perf(parse): bulk-copy literal runs in the entity decoder (#291) 2026-06-25 11:45:02 +02:00
ExternalID.swift feat(parsing): per-entity base-URI tracking for nested external entities 2026-06-10 08:24:17 +02:00
GB18030Decoder.swift refactor(parsing): drop slice copies; document the expansion bounds 2026-06-10 04:01:16 +02:00
GB18030Ranges.swift
GBKDecoder.swift
GBKTable1.swift
GBKTable2.swift
GBKTable3.swift
GBKTable4.swift
GBKTable5.swift
GBKTable6.swift
InputEncoding.swift docs: align stale figures with code and the enforced XSTS gate 2026-06-19 23:32:04 +02:00
ISO2022JPDecoder.swift refactor(parsing): drop slice copies; document the expansion bounds 2026-06-10 04:01:16 +02:00
JIS0208Table1.swift
JIS0208Table2.swift
JIS0208Table3.swift
JIS0212Table1.swift
JIS0212Table2.swift
Limits.swift feat(parsing): strict internal-subset profile, xmltest 185 of 186 2026-06-10 08:29:54 +02:00
Mark.swift
NamespaceContext.swift perf(parsing): resolve namespaces in O(1), making parse linear in depth (#346) 2026-06-26 17:44:27 +02:00
ParsedDocument.swift
ParseError.swift feat(parsing): Namespaces 1.0 constraint enforcement 2026-06-10 08:06:45 +02:00
Parser.swift feat(parsing): IBM section clean, entity-declared WFC/VC split, declaration recursion 2026-06-10 07:26:50 +02:00
ParserTreeBuild.swift perf(parse): build the TreeNode tree directly from the event stream (#295) 2026-06-25 14:15:57 +02:00
PseudoAttributeScanner.swift feat(parsing): fourth W3C-suite strictness pass, declaration grammar 2026-06-10 05:34:11 +02:00
PushAsync.swift
PushParser.swift
PushScanner.swift
Reader.swift perf(parsing): make entity/content expansion linear, not quadratic (#338) 2026-06-26 13:55:29 +02:00
ReaderByteRuns.swift perf(parsing): skip reference decoding for ampersand-free attribute values (#278) 2026-06-25 00:17:31 +02:00
ReadResult.swift
SAXHandler.swift
ShiftJISDecoder.swift
SingleByteEncodings.swift
SingleByteTables.swift
SourceRange.swift
StreamingDecoder.swift feat(parsing): EUC-TW (CNS 11643) decoding, closing #108 2026-06-09 17:44:22 +02:00
StreamingDecoderEUCTW.swift feat(parsing): EUC-TW (CNS 11643) decoding, closing #108 2026-06-09 17:44:22 +02:00
StreamingDecoderISO2022JP.swift
TextReader.swift
UnparsedEntity.swift
ValidityFinding.swift refactor(validation): located structured validity findings 2026-06-10 10:45:17 +02:00
XMLCharacter.swift perf(parsing): byte-level scanning fast paths halve parse time vs libxml2 (#275) 2026-06-24 18:46:58 +02:00
XMLDeclaration.swift feat(parsing): strict DTD subset grammar, oasis section of xmlconf fully clean 2026-06-10 06:29:13 +02:00