Commit c1a1328c authored by Russ Cox's avatar Russ Cox
Browse files

encoding/xml: add wildcard support for collecting all attributes

- 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/30946


Reviewed-by: default avatarQuentin Smith <quentin@golang.org>
parent 0794dce0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment