LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package xml | 5 package xml |
6 | 6 |
7 import ( | 7 import ( |
8 "bufio" | 8 "bufio" |
9 "bytes" | 9 "bytes" |
10 "fmt" | 10 "fmt" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // The name for the XML elements is taken from, in order of preference: | 41 // The name for the XML elements is taken from, in order of preference: |
42 // - the tag on the XMLName field, if the data is a struct | 42 // - the tag on the XMLName field, if the data is a struct |
43 // - the value of the XMLName field of type xml.Name | 43 // - the value of the XMLName field of type xml.Name |
44 // - the tag of the struct field used to obtain the data | 44 // - the tag of the struct field used to obtain the data |
45 // - the name of the struct field used to obtain the data | 45 // - the name of the struct field used to obtain the data |
46 // - the name of the marshalled type | 46 // - the name of the marshalled type |
47 // | 47 // |
48 // The XML element for a struct contains marshalled elements for each of the | 48 // The XML element for a struct contains marshalled elements for each of the |
49 // exported fields of the struct, with these exceptions: | 49 // exported fields of the struct, with these exceptions: |
50 // - the XMLName field, described above, is omitted. | 50 // - the XMLName field, described above, is omitted. |
51 // - a field with tag "-" is omitted. | |
52 // - a field with tag "name,attr" becomes an attribute with | 51 // - a field with tag "name,attr" becomes an attribute with |
53 // the given name in the XML element. | 52 // the given name in the XML element. |
54 // - a field with tag ",attr" becomes an attribute with the | 53 // - a field with tag ",attr" becomes an attribute with the |
55 // field name in the in the XML element. | 54 // field name in the in the XML element. |
56 // - a field with tag ",chardata" is written as character data, | 55 // - a field with tag ",chardata" is written as character data, |
57 // not as an XML element. | 56 // not as an XML element. |
58 // - a field with tag ",innerxml" is written verbatim, not subject | 57 // - a field with tag ",innerxml" is written verbatim, not subject |
59 // to the usual marshalling procedure. | 58 // to the usual marshalling procedure. |
60 // - a field with tag ",comment" is written as an XML comment, not | 59 // - a field with tag ",comment" is written as an XML comment, not |
61 // subject to the usual marshalling procedure. It must not contain | 60 // subject to the usual marshalling procedure. It must not contain |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 390 |
392 // A MarshalXMLError is returned when Marshal encounters a type | 391 // A MarshalXMLError is returned when Marshal encounters a type |
393 // that cannot be converted into XML. | 392 // that cannot be converted into XML. |
394 type UnsupportedTypeError struct { | 393 type UnsupportedTypeError struct { |
395 Type reflect.Type | 394 Type reflect.Type |
396 } | 395 } |
397 | 396 |
398 func (e *UnsupportedTypeError) Error() string { | 397 func (e *UnsupportedTypeError) Error() string { |
399 return "xml: unsupported type: " + e.Type.String() | 398 return "xml: unsupported type: " + e.Type.String() |
400 } | 399 } |
LEFT | RIGHT |