Skip DOCTYPE comments/PIs and match root namespaces only as attributes

- The DOCTYPE scan now jumps over whole comments and processing
  instructions found outside a declaration string literal, so a quote or
  bracket inside them no longer leaves the scanner stuck before the root.
- Root namespace repair walks the root's attributes in order, so
  declaration-like text inside a quoted value can no longer fill `seen`
  and cause the real declaration to be dropped as a duplicate.
- Regression tests for both, plus linear-time cases in the isolated
  deadline test.
- CURRENT-STATE: describe the scanner as a boundary check and leave the
  rest of the XML grammar to DOMParser.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Said TurkseverandClaude Opus 5.5 committed 2026-10-23 12:30:32 +01:00
1 parent 5ca2266f53
commit 6b2aa95cc6
3 files changed
+76 -16

No files matched your search

+9 -4
View File
@@ -10,10 +10,15 @@ lookups preserve the previous analyst cohort and boundary source. Navigation
search keeps a successful geocode, with no search or view-based region recovery.
KML namespace repair locates the opening token once and scans its quoted tag
delimiter once. Malformed or unterminated tags fail before DOM parsing, so a file
of repeated incomplete `<kml` prefixes cannot trigger quadratic regex rescans.
Duplicate namespace repair and missing xsi declarations remain supported; GPX
continues through its existing XML parsing path.
delimiter once, skipping prolog and DOCTYPE comments and processing
instructions whole. The scanner is a boundary check only: an opening KML tag
that never closes, or one with raw markup starting inside it, fails before DOM
parsing, so a file of repeated incomplete `<kml` prefixes cannot trigger
quadratic regex rescans. All other XML grammar, including attribute syntax
inside a complete root tag, is left to DOMParser. Namespace declarations are
recognized only as whole root attributes, never inside quoted values; duplicate
namespace repair and missing xsi declarations remain supported. GPX continues
through its existing XML parsing path.
Terrain height requests accept at most 64 points, matching the browser service's
existing batch size and one bounded upstream chunk. Larger requests return HTTP