Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/xml: createAttrPrefix should ban "XMLanything" case insensitive, not just "xmlanything" #35151
What version of Go are you using (
under 3 "Declaring Namespaces".
Also https://www.w3.org/TR/REC-xml/ says
under "2.3 Common Syntactic Constructs".
…tive" This reverts CL 203417. Reason for revert: This change changes uses of tags like "XMLSchema-instance" without any recourse. For #35151 Fixes #39876 Change-Id: I4c85c8267a46b3748664b5078794dafffb42aa26 Reviewed-on: https://go-review.googlesource.com/c/go/+/240179 Run-TryBot: Ian Lance Taylor <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Emmanuel Odeke <firstname.lastname@example.org> Reviewed-by: Andrew Bonventre <email@example.com>
@tgulacsi Thanks for the context. I look at dozens of different issues every day, so I can't always keep them all in my head.
The CL that reverted your CL, https://golang.org/cl/240179, says "Reason for revert: This change changes uses of tags like "XMLSchema-instance" without any recourse" and refers to #39876. #39876 explains the problem, and you commented there. That issue has a test case whose behavior changed. Any change we make should not change the behavior of that test case, or other similar test cases.
The Go project takes backward compatibility very seriously. We do not want to break existing programs. There needs to be a very good reason to not do that. Perhaps we made a mistake in the fix for #5040, but we still don't want to break existing programs.
Worse, as #39876 says, after your earlier change (https://golang.org/cl/203417) there was no way for a program to get the string that it got before. So not only did the behavior change, there was no way to get the old behavior.
In your new CL (https://golang.org/cl/254978) you are introducing new API: a new method
But first let's take a step back.
What is the real problem here that we are trying to solve? What goes wrong if we don't fix this? Perhaps you understand that, but I don't. Perhaps that can help guide us to the right solution.
From one of my clients, I got back this:
And https://www.w3.org/TR/REC-xml/ says she's right.
That's what I try to solve.
As far as I see, it's https://github.com/golang/go/blob/master/src/encoding/xml/marshal.go#L339 where it starts to pick a short name (tag?) for the namespace. If possible, it uses the namespace url's path's last section.
AFAIK a random name would work, too - that's why I don't understand what does it break.