Fix no-go area parsing for namespaced XML elements

querySelectorAll('nogo') doesn't match <trails:nogo>. Now matches
both unprefixed and prefixed element names.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-04-03 12:26:54 +01:00
parent e12479293d
commit 6ccf7af7b1
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9

View file

@ -88,10 +88,11 @@ function parseTracks(doc: Document): TrackPoint[][] {
function parseNoGoAreas(doc: Document): NoGoArea[] {
const areas: NoGoArea[] = [];
const nogos = doc.querySelectorAll("nogo");
// Match both unprefixed and prefixed (trails:nogo) elements
const nogos = doc.querySelectorAll("nogo, trails\\:nogo");
for (const nogo of Array.from(nogos)) {
const points: Array<{ lat: number; lon: number }> = [];
const pts = nogo.querySelectorAll("point");
const pts = nogo.querySelectorAll("point, trails\\:point");
for (const pt of Array.from(pts)) {
const lat = parseFloat(pt.getAttribute("lat") ?? "0");
const lon = parseFloat(pt.getAttribute("lon") ?? "0");