go/src/encoding
Roger Peppe bb7e665687 encoding/xml: fix xmlns= behavior
When an xmlns="..." attribute was explicitly generated,
it was being ignored because the name space on the
attribute was assumed to have been explicitly set (to the empty
name space) and it's not possible to have an element in the
empty name space when there is a non-empty name space set.

We fix this by recording when a default name space has been
explicitly set and setting the name space of the element to that
so printer.defineNS can do its work correctly.

We do not attempt to add our own xmlns="..." attribute
when one is explicitly set.

We also add tests for EncodeElement, as that's the only way
to attain coverage of some of the changed behaviour.
Some other test coverage is also increased, although
more work remains to be done in this area.

This change was jointly developed with Martin Hilton (mhilton on github).

Fixes #11431.

Change-Id: I7b85e06eea5b18b2c15ec16dcbd92a8e1d6a9a4e
Reviewed-on: https://go-review.googlesource.com/11635
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-30 07:42:37 +00:00
..
ascii85 build: move package sources from src/pkg to src 2014-09-08 00:08:51 -04:00
asn1 encoding/asn1: don't parse invalid UTF-8. 2015-06-29 02:50:49 +00:00
base32 build: move package sources from src/pkg to src 2014-09-08 00:08:51 -04:00
base64 encoding/base64: Optimize EncodeToString and DecodeString. 2015-04-24 01:45:43 +00:00
binary encoding/binary: update protobuf documentation link 2015-06-29 14:28:01 +00:00
csv encoding/csv: add examples for package 2015-06-22 11:11:37 +00:00
gob encoding/gob: fix infinite recursion caused by ignoring recursive type 2015-06-01 18:42:29 +00:00
hex build: move package sources from src/pkg to src 2014-09-08 00:08:51 -04:00
json encoding/json: Remove extra allocation in scanner. 2015-06-18 17:59:42 +00:00
pem testing/quick: probabilistically generate nil pointers 2015-06-08 21:19:13 +00:00
xml encoding/xml: fix xmlns= behavior 2015-06-30 07:42:37 +00:00
encoding.go build: move package sources from src/pkg to src 2014-09-08 00:08:51 -04:00