fix: builtins/publish: keep xs+xsi NS in cleanup - #334
Open
vladimir-mencl-eresearch wants to merge 2 commits into
Open
fix: builtins/publish: keep xs+xsi NS in cleanup#334vladimir-mencl-eresearch wants to merge 2 commits into
vladimir-mencl-eresearch wants to merge 2 commits into
Conversation
Fixes IdentityPython#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.
Author
|
FYI @theseal @btmattsson |
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)
Author
|
Hi, I have looked into this a bit deeper - I was surprised #333 broke only conventional metadata but not MDQ. Turns out the namespace cleanup was skipping over MDQ ( So I have moved the namespace cleanup to where the document is created - that solves it also for MDQ files (and I have kept Please let me know what you think. If you'd rather just fix #333 only with no other changes, the first commit will do it. The second commit makes NS cleanup apply also to MDQ files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #333
The
lxml.etree.cleanup_namespacesfunction only considers namespaces used in XML Element and Attribute names, but not in attribute values. Thexsnamespace is used only in values ofxsi:typeattributes and is thus not considered as used by LXML, and would get removed.Keep it explicitly to avoid creating invalid metadata.
All Submissions: