Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/xml: Marshal ignores XMLName field from anonymous struct field #7614
What does 'go version' print? go version go1.2.1 linux/amd64 What steps reproduce the problem? Just to http://play.golang.org/p/85oWtwZAq9 and Run. What happened? Embedded struct defines XMLName field with xml.Name type and with corresponding field tag. xml.Marshal ignores this XMLName field from embeded struct and outer tag is generated from object's struct type name. What should have happened instead? Documentation for xml.Marshal says: - an anonymous struct field is handled as if the fields of its value were part of the outer struct. So I expected that XMLName of type xml.Name from embedded struct should be marshaled as xml tag name. Please provide any additional information below.