Skip to main content

Module location

Module location 

Source
Expand description

Location tracking for XSD parsing

This module provides accurate source location tracking using byte offsets from quick-xml. It supports three retention modes to balance memory usage vs. error reporting fidelity:

  • Retain: Keep full source text (default, ~200KB per 200KB schema)
  • DropText: Keep only line starts (~10KB per 200KB schema)
  • DropAll: No location info (minimal memory)

Per XSD_PARSER_DESIGN.md:

  • Use quick-xml’s buffer_position() for byte offsets
  • Build line_starts table once per document
  • Handle CR, LF, and CRLF line endings correctly
  • Column calculation counts UTF-8 characters, not bytes

Structs§

CompactSourceMap
Compact source map when text is dropped (DropText mode)
SourceLocation
Line/column location for error reporting (1-based)
SourceMap
Per-document source mapping for line/column resolution
SourceRef
Reference to a location within a schema document
SourceSpan
Byte range within a document

Enums§

SourceMapStorage
Centralized source map storage with configurable retention
SourceRetention
Source buffer retention policy

Functions§

build_line_starts
Build line start index from source bytes