Skip to content

Fix keep xs ns prefixes - #335

Open
theseal wants to merge 4 commits into
masterfrom
fix-keep-xs-ns-prefixes
Open

Fix keep xs ns prefixes#335
theseal wants to merge 4 commits into
masterfrom
fix-keep-xs-ns-prefixes

Conversation

@theseal

@theseal theseal commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@vladimir-mencl-eresearch commits where unsigned and I was not allowed to write in the incoming branch so had to do this branch dance. 🤷‍♂️

Also added test to check for the "default" NSes.

Closes #333 and #334

Fixes #333

The lxml.etree.cleanup_namespaces function only considers namespaces used
in XML Element and Attribute names, but not in attribute values.
The xs namespaces is used only in values of xsi:type attributes
and is thus not considered as used by LXML - and would get removed.

Keep it explicitly to avoid creating invalid metadata.

Co-authored-by: Johan Wassberg <jocar@sunet.se>
The namespace cleanup was being ignored for MDQ
per-entity publication - it did nothing when
invoked on element other than the root element.

It would also be resource intensive to clean up
when publishing each individual element.

Clean up instead at the source - and there,
the guard condition is no longer required
(the working document is always XML)

Co-authored-by: Johan Wassberg <jocar@sunet.se>
@theseal
theseal requested a review from btmattsson September 4, 2026 08:41
Comment thread src/pyff/samlmd.py Outdated
Instead of a hardcorded list of known Qname defines
@theseal

theseal commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@vladimir-mencl-eresearch Can you try this branch out before we do a merge?

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.

Regression: cleanup_namespaces removes also xs + xsi prefixes

3 participants