• Russ Cox's avatar
    encoding/xml: add wildcard support for collecting all attributes · c1a1328c
    Russ Cox authored
    - Like ",any" for elements, add ",any,attr" for attributes to allow
      a mop-up field that gets any otherwise unmapped attributes.
    - Map attributes to fields of type slice by extending the slice,
      just like for elements.
    - Allow storing an attribute into an xml.Attr directly, to provide
      a way to record the name.
    
    Combined, these three independent features allow
    
    	AllAttrs []Attr `xml:",any,attr"`
    
    to collect all attributes not otherwise spoken for in a particular struct.
    
    Tests based on CL 16292 by Charles Weill.
    
    Fixes #3633.
    
    Change-Id: I2d75817f17ca8752d7df188080a407836af92611
    Reviewed-on: https://go-review.googlesource.com/30946Reviewed-by: 's avatarQuentin Smith <quentin@golang.org>
    c1a1328c
marshal.go 28.4 KB