Skip to content

Is it possible to remove all namespace prefixes #931

Answered by tefra
GilesNicholas asked this question in Q&A
Discussion options

You must be logged in to vote

There is no way to know from a top element the namespaces of child elements, unless we do multiple passes, which will slow down the serializer a lot. Not even lxml can do this automatically, but lxml provides https://lxml.de/apidoc/lxml.etree.html#lxml.etree.cleanup_namespaces

You could override https://github.com/tefra/xsdata/blob/main/xsdata/formats/dataclass/serializers/writers/lxml.py in order cleanup the namespaces of the generated self.handler.etree

There is no easy way to integrate that in the xsdata default writers.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tefra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants