You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm trying to assign a particular attribute (xmlns:ds) with the same key, value pairing, which has also been previously defined on a higher-level element. It applies correctly for the node closest to the root, but not for the lower nodes nodes.
This is not a bug but a feature of the serializer.
xmlbuilder2 keeps a record of namespaces while serializing the document. It can add, modify and even remove namespace prefixes. But it preserves the meaning of the document.
In your case, the parent foo element node declares the namespace att with the prefix ds. So, foo and all of its child elements have access to this namespace. Redeclaring the namespace under the child foobar element node is superfluous as it is already declared by foo. If you would canonicalize both documents you would see they are identical.
Describe the bug
I'm trying to assign a particular attribute (
xmlns:ds
) with the same key, value pairing, which has also been previously defined on a higher-level element. It applies correctly for the node closest to the root, but not for the lower nodes nodes.To Reproduce
Expected behavior
I expect each
foobar
to have@xmlns:ds
as an attribute, but they do not.The current output (2.4.0) looks like:
What I'm expecting:
Before passing to
create()
, the structure hints that the attribute should be set:Version:
The text was updated successfully, but these errors were encountered: