- 
                Notifications
    You must be signed in to change notification settings 
- Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.early-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.
Milestone
Description
It's not obvious at first glance how, but https://golang.org/cl/2660 changed the behavior of the XML marshaler for people who were generating xmlns attributes "by hand". For example:
package main
import (
    "encoding/xml"
    "fmt"
    "log"
)
type T struct {
    Ns   string `xml:"xmlns,attr"`
    Body string
}
func main() {
    t := &T{Ns: "http://example.com/ns", Body: "hello world"}
    x, err := xml.Marshal(t)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%s\n", x)
}
In Go 1.4 this program printed:
<T xmlns="http://example.com/ns"><Body>hello world</Body></T>
After this CL it prints:
<T><Body>hello world</Body></T>
In the absence of compelling justification for a breaking change, I think we should try to continue to support this way of setting the default xmlns.
I've seen tests break due to this change, and presumably real programs would break too, if the xmlns= were important.
What can we do to interpret these old programs correctly in the new more-namespace-aware world for Go 1.5?
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.early-in-cycleA change that should be done early in the 3 month dev cycle.A change that should be done early in the 3 month dev cycle.