• Roger Peppe's avatar
    encoding/xml: fix xmlns= behavior · bb7e6656
    Roger Peppe authored
    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/11635Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    bb7e6656
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...