Skip to content

Commit e3ab30b

Browse files
committed
encoding/xml: add docs for ignoring tag
That was supposed to be in the original CL, but missed the files. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5570052
1 parent 0bb8ce2 commit e3ab30b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/pkg/encoding/xml/marshal.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type Marshaler interface {
4848
// The XML element for a struct contains marshalled elements for each of the
4949
// exported fields of the struct, with these exceptions:
5050
// - the XMLName field, described above, is omitted.
51+
// - a field with tag "-" is omitted.
5152
// - a field with tag "name,attr" becomes an attribute with
5253
// the given name in the XML element.
5354
// - a field with tag ",attr" becomes an attribute with the

src/pkg/encoding/xml/read.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ import (
132132
// of the above rules and the struct has a field with tag ",any",
133133
// unmarshal maps the sub-element to that struct field.
134134
//
135+
// * A struct field with tag "-" is never unmarshalled into.
136+
//
135137
// Unmarshal maps an XML element to a string or []byte by saving the
136138
// concatenation of that element's character data in the string or
137139
// []byte. The saved []byte is never nil.

0 commit comments

Comments
 (0)