GNOME Bugzilla – Bug 329347
remove redundant namespaces in serialization
Last modified: 2021-07-05 13:27:13 UTC
Hi, I'd like to have an option for the serializer so it removes redundant namespaces, based on the assumption that 2 namespaces are equal when their URI's are equal. Andreas
Since I'm monitoring the lxml mailing-list, I suppose the issue is related to extensive copy of nodes with xmlCopyNode() or xmlDocCopyNode() and the fact that those functions will add namespace declaration attributes to the copied element-node if a namespace binding is not is scope, resulting in many redundant ns-decls. This issue might be a duplicate of bug #142880.
I just enhanced xmlDOMWrapReconcileNamespaces() in tree.c (revision 1.361) to remove redundant ns-decls if the option XML_DOM_RECONNS_REMOVEREDUND was given. Note that I haven't moved this option to the header file yet; so just call this function with an @option of 1 to test the behaviour. I know this is not what you requested, but maybe you'll find it usefull for the redundant-ns-decls issue.
Fixed some bugs xmlDOMWrapReconcileNamespaces() wrt the previous addition of the removal of redundant ns-decls - tree.c, revision 1.362. Performed some rudimental tests.
Whoops, sorry I changed the status of this bug by accident - it was intended for an other bug :-/
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.