Skip to content

Add support for fixed default element namespace#2618

Merged
ChristianGruen merged 2 commits intoBaseXdb:mainfrom
GuntherRademacher:fixed-default
Mar 10, 2026
Merged

Add support for fixed default element namespace#2618
ChristianGruen merged 2 commits intoBaseXdb:mainfrom
GuntherRademacher:fixed-default

Conversation

@GuntherRademacher
Copy link
Member

This PR adds support for the XQuery 4.0 feature declare fixed default element namespace.

When fixed is declared, the default element/type namespace is no longer affected by xmlns declarations on direct element constructors. To support this, the static context now distinguishes between:

  • the default namespace used for expression QName resolution (elemNS)
  • the default namespace used for direct element constructors (dirNS)

QName resolution was adjusted accordingly, and deferred QName resolution during parsing was updated to use the correct namespace context. Minor cleanups were included (avoiding entries for already-resolved QNames).

A new NamespaceTest.fixed() test method was added to cover the new behavior. Also these QT4 tests now pass successfully:

  • default-namespace-40-01
  • default-namespace-40-02
  • default-namespace-40-03
  • default-namespace-40-04

The second commit in this PR refactors QNmCache and QNmCheck, because their previous naming was somewhat misleading. The classes are replaced by QNmResolver that stores deferred resolution entries in a small record. The refactoring simplifies the control flow, removes redundant checks, and makes the intent of the code - resolving namespace URIs of QNames once the namespace context is known - more explicit.

@ChristianGruen
Copy link
Member

Looks all good. And thanks for introducing the QNmResolver class, it is much more intuitive than what we had before.

@ChristianGruen ChristianGruen merged commit 70407b2 into BaseXdb:main Mar 10, 2026
1 check passed
@ChristianGruen ChristianGruen deleted the fixed-default branch March 10, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants