Namespace: go.std.encoding.xml
v1.0Contents
Summary
Provides a low-level interface to the encoding/xml package.
Package xml implements a simple XML 1.0 parser that
understands XML name spaces.
Index
- *Attr
- *CharData
- *Comment
- *Decoder
- *Directive
- *Encoder
- *EndElement
- *Name
- *ProcInst
- *StartElement
- *SyntaxError
- *TagPathError
- *UnmarshalError
- *UnsupportedTypeError
- Attr
- CharData
- Comment
- CopyToken
- Decoder
- Directive
- Encoder
- EndElement
- Escape
- EscapeText
- HTMLAutoClose
- HTMLEntity
- Header
- Marshal
- MarshalIndent
- Marshaler
- MarshalerAttr
- Name
- NewDecoder
- NewEncoder
- NewTokenDecoder
- ProcInst
- StartElement
- SyntaxError
- TagPathError
- Token
- TokenReader
- Unmarshal
- UnmarshalError
- Unmarshaler
- UnmarshalerAttr
- UnsupportedTypeError
- arrayOfAttr
- arrayOfCharData
- arrayOfComment
- arrayOfDecoder
- arrayOfDirective
- arrayOfEncoder
- arrayOfEndElement
- arrayOfMarshaler
- arrayOfMarshalerAttr
- arrayOfName
- arrayOfProcInst
- arrayOfStartElement
- arrayOfSyntaxError
- arrayOfTagPathError
- arrayOfToken
- arrayOfTokenReader
- arrayOfUnmarshalError
- arrayOfUnmarshaler
- arrayOfUnmarshalerAttr
- arrayOfUnsupportedTypeError
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
Header
String v1.0Header is a generic XML header suitable for use with the output of Marshal.
This is not automatically added to any output of this package,
it is provided as a convenience.
Variables
-
HTMLAutoClose
Var v1.0HTMLAutoClose is the set of HTML elements that
should be considered to close automatically.
See the Decoder.Strict and Decoder.Entity fields' documentation.
-
HTMLEntity
Var v1.0HTMLEntity is an entity map containing translations for the
standard HTML entity characters.
See the Decoder.Strict and Decoder.Entity fields' documentation.
Functions, Macros, and Special Forms
-
CopyToken
Function v1.0(CopyToken t)
CopyToken returns a copy of a Token.
Go input arguments: (t Token)
Go returns: Token
Joker input arguments: [^Token t]
Joker returns: ^Token -
Escape
Function v1.0(Escape w s)
Escape is like EscapeText but omits the error return value.
It is provided for backwards compatibility with Go 1.0.
Code targeting Go 1.1 or later should use EscapeText.
Go input arguments: (w io.Writer, s []byte)
Joker input arguments: [^go.std.io/Writer w, ^arrayOfByte s] -
EscapeText
Function v1.0(EscapeText w s)
EscapeText writes to w the properly escaped XML equivalent
of the plain text data s.
Go input arguments: (w io.Writer, s []byte)
Go returns: error
Joker input arguments: [^go.std.io/Writer w, ^arrayOfByte s]
Joker returns: ^Error -
Marshal
Function v1.0(Marshal v)
Marshal returns the XML encoding of v.
Marshal handles an array or slice by marshaling each of the elements.
Marshal handles a pointer by marshaling the value it points at or, if the
pointer is nil, by writing nothing. Marshal handles an interface value by
marshaling the value it contains or, if the interface value is nil, by
writing nothing. Marshal handles all other data by writing one or more XML
elements containing the data.
The name for the XML elements is taken from, in order of preference:
- the tag on the XMLName field, if the data is a struct
- the value of the XMLName field of type Name
- the tag of the struct field used to obtain the data
- the name of the struct field used to obtain the data
- the name of the marshaled type
The XML element for a struct contains marshaled elements for each of the
exported fields of the struct, with these exceptions:
- the XMLName field, described above, is omitted.
- a field with tag "-" is omitted.
- a field with tag "name,attr" becomes an attribute with
the given name in the XML element.
- a field with tag ",attr" becomes an attribute with the
field name in the XML element.
- a field with tag ",chardata" is written as character data,
not as an XML element.
- a field with tag ",cdata" is written as character data
wrapped in one or more <![CDATA[ ... ]]> tags, not as an XML element.
- a field with tag ",innerxml" is written verbatim, not subject
to the usual marshaling procedure.
- a field with tag ",comment" is written as an XML comment, not
subject to the usual marshaling procedure. It must not contain
the "--" string within it.
- a field with a tag including the "omitempty" option is omitted
if the field value is empty. The empty values are false, 0, any
nil pointer or interface value, and any array, slice, map, or
string of length zero.
- an anonymous struct field is handled as if the fields of its
value were part of the outer struct.
- a field implementing Marshaler is written by calling its MarshalXML
method.
- a field implementing encoding.TextMarshaler is written by encoding the
result of its MarshalText method as text.
If a field uses a tag "a>b>c", then the element c will be nested inside
parent elements a and b. Fields that appear next to each other that name
the same parent will be enclosed in one XML element.
If the XML name for a struct field is defined by both the field tag and the
struct's XMLName field, the names must match.
See MarshalIndent for an example.
Marshal will return an error if asked to marshal a channel, function, or map.
Go input arguments: (v any)
Go returns: ([]byte, error)
Joker input arguments: [^GoObject v]
Joker returns: [^arrayOfByte, ^Error] -
MarshalIndent
Function v1.0(MarshalIndent v prefix indent)
MarshalIndent works like Marshal, but each XML element begins on a new
indented line that starts with prefix and is followed by one or more
copies of indent according to the nesting depth.
Go input arguments: (v any, prefix string, indent string)
Go returns: ([]byte, error)
Joker input arguments: [^GoObject v, ^String prefix, ^String indent]
Joker returns: [^arrayOfByte, ^Error] -
NewDecoder
Function v1.0(NewDecoder r)
NewDecoder creates a new XML parser reading from r.
If r does not implement io.ByteReader, NewDecoder will
do its own buffering.
Go input arguments: (r io.Reader)
Go returns: *Decoder
Joker input arguments: [^go.std.io/Reader r]
Joker returns: ^*Decoder -
NewEncoder
Function v1.0(NewEncoder w)
NewEncoder returns a new encoder that writes to w.
Go input arguments: (w io.Writer)
Go returns: *Encoder
Joker input arguments: [^go.std.io/Writer w]
Joker returns: ^*Encoder -
NewTokenDecoder
Function v1.0(NewTokenDecoder t)
NewTokenDecoder creates a new XML parser using an underlying token stream.
Go input arguments: (t TokenReader)
Go returns: *Decoder
Joker input arguments: [^TokenReader t]
Joker returns: ^*Decoder -
Unmarshal
Function v1.0(Unmarshal data v)
Unmarshal parses the XML-encoded data and stores the result in
the value pointed to by v, which must be an arbitrary struct,
slice, or string. Well-formed data that does not fit into v is
discarded.
Because Unmarshal uses the reflect package, it can only assign
to exported (upper case) fields. Unmarshal uses a case-sensitive
comparison to match XML element names to tag values and struct
field names.
Unmarshal maps an XML element to a struct using the following rules.
In the rules, the tag of a field refers to the value associated with the
key 'xml' in the struct field's tag (see the example above).
- If the struct has a field of type []byte or string with tag
",innerxml", Unmarshal accumulates the raw XML nested inside the
element in that field. The rest of the rules still apply.
- If the struct has a field named XMLName of type Name,
Unmarshal records the element name in that field.
- If the XMLName field has an associated tag of the form
"name" or "namespace-URL name", the XML element must have
the given name (and, optionally, name space) or else Unmarshal
returns an error.
- If the XML element has an attribute whose name matches a
struct field name with an associated tag containing ",attr" or
the explicit name in a struct field tag of the form "name,attr",
Unmarshal records the attribute value in that field.
- If the XML element has an attribute not handled by the previous
rule and the struct has a field with an associated tag containing
",any,attr", Unmarshal records the attribute value in the first
such field.
- If the XML element contains character data, that data is
accumulated in the first struct field that has tag ",chardata".
The struct field may have type []byte or string.
If there is no such field, the character data is discarded.
- If the XML element contains comments, they are accumulated in
the first struct field that has tag ",comment". The struct
field may have type []byte or string. If there is no such
field, the comments are discarded.
- If the XML element contains a sub-element whose name matches
the prefix of a tag formatted as "a" or "a>b>c", unmarshal
will descend into the XML structure looking for elements with the
given names, and will map the innermost elements to that struct
field. A tag starting with ">" is equivalent to one starting
with the field name followed by ">".
- If the XML element contains a sub-element whose name matches
a struct field's XMLName tag and the struct field has no
explicit name tag as per the previous rule, unmarshal maps
the sub-element to that struct field.
- If the XML element contains a sub-element whose name matches a
field without any mode flags (",attr", ",chardata", etc), Unmarshal
maps the sub-element to that struct field.
- If the XML element contains a sub-element that hasn't matched any
of the above rules and the struct has a field with tag ",any",
unmarshal maps the sub-element to that struct field.
- An anonymous struct field is handled as if the fields of its
value were part of the outer struct.
- A struct field with tag "-" is never unmarshaled into.
If Unmarshal encounters a field type that implements the Unmarshaler
interface, Unmarshal calls its UnmarshalXML method to produce the value from
the XML element. Otherwise, if the value implements
encoding.TextUnmarshaler, Unmarshal calls that value's UnmarshalText method.
Unmarshal maps an XML element to a string or []byte by saving the
concatenation of that element's character data in the string or
[]byte. The saved []byte is never nil.
Unmarshal maps an attribute value to a string or []byte by saving
the value in the string or slice.
Unmarshal maps an attribute value to an Attr by saving the attribute,
including its name, in the Attr.
Unmarshal maps an XML element or attribute value to a slice by
extending the length of the slice and mapping the element or attribute
to the newly created value.
Unmarshal maps an XML element or attribute value to a bool by
setting it to the boolean value represented by the string. Whitespace
is trimmed and ignored.
Unmarshal maps an XML element or attribute value to an integer or
floating-point field by setting the field to the result of
interpreting the string value in decimal. There is no check for
overflow. Whitespace is trimmed and ignored.
Unmarshal maps an XML element to a Name by recording the element
name.
Unmarshal maps an XML element to a pointer by setting the pointer
to a freshly allocated value and then mapping the element to that value.
A missing element or empty attribute value will be unmarshaled as a zero value.
If the field is a slice, a zero value will be appended to the field. Otherwise, the
field will be set to its zero value.
Go input arguments: (data []byte, v any)
Go returns: error
Joker input arguments: [^arrayOfByte data, ^GoObject v]
Joker returns: ^Error
Types
-
*Attr
Concrete Type v1.0An Attr represents an attribute in an XML element (Name=Value).
-
*CharData
Concrete Type v1.0A CharData represents XML character data (raw text),
in which XML escape sequences have been replaced by
the characters they represent.
-
*Comment
Concrete Type v1.0A Comment represents an XML comment of the form <!--comment-->.
The bytes do not include the <!-- and --> comment markers.
-
*Decoder
Concrete Type v1.0A Decoder represents an XML parser reading a particular input stream.
The parser assumes that its input is encoded in UTF-8.
-
Decode
Receiver for *Decoder v1.0([v])
Decode works like Unmarshal, except it reads the decoder
stream to find the start element.
-
DecodeElement
Receiver for *Decoder v1.0([v start])
DecodeElement works like Unmarshal except that it takes
a pointer to the start XML element to decode into v.
It is useful when a client reads some raw XML tokens itself
but also wants to defer to Unmarshal for some elements.
-
InputOffset
Receiver for *Decoder v1.0([])
InputOffset returns the input stream byte offset of the current decoder position.
The offset gives the location of the end of the most recently returned token
and the beginning of the next token.
-
InputPos
Receiver for *Decoder v1.0([])
InputPos returns the line of the current decoder position and the 1 based
input position of the line. The position gives the location of the end of the
most recently returned token.
-
RawToken
Receiver for *Decoder v1.0([])
RawToken is like Token but does not verify that
start and end elements match and does not translate
name space prefixes to their corresponding URLs.
-
Skip
Receiver for *Decoder v1.0([])
Skip reads tokens until it has consumed the end element
matching the most recent start element already consumed,
skipping nested structures.
It returns nil if it finds an end element matching the start
element; otherwise it returns an error describing the problem.
-
Token
Receiver for *Decoder v1.0([])
Token returns the next XML token in the input stream.
At the end of the input stream, Token returns nil, io.EOF.
Slices of bytes in the returned token data refer to the
parser's internal buffer and remain valid only until the next
call to Token. To acquire a copy of the bytes, call CopyToken
or the token's Copy method.
Token expands self-closing elements such as <br>
into separate start and end elements returned by successive calls.
Token guarantees that the StartElement and EndElement
tokens it returns are properly nested and matched:
if Token encounters an unexpected end element
or EOF before all expected end elements,
it will return an error.
Token implements XML name spaces as described by
https://www.w3.org/TR/REC-xml-names/. Each of the
Name structures contained in the Token has the Space
set to the URL identifying its name space when known.
If Token encounters an unrecognized name space prefix,
it uses the prefix as the Space rather than report an error.
-
*Directive
Concrete Type v1.0A Directive represents an XML directive of the form <!text>.
The bytes do not include the <! and > markers.
-
*Encoder
Concrete Type v1.0An Encoder writes XML data to an output stream.
-
Encode
Receiver for *Encoder v1.0([v])
Encode writes the XML encoding of v to the stream.
See the documentation for Marshal for details about the conversion
of Go values to XML.
Encode calls Flush before returning.
-
EncodeElement
Receiver for *Encoder v1.0([v start])
EncodeElement writes the XML encoding of v to the stream,
using start as the outermost tag in the encoding.
See the documentation for Marshal for details about the conversion
of Go values to XML.
EncodeElement calls Flush before returning.
-
EncodeToken
Receiver for *Encoder v1.0([t])
EncodeToken writes the given XML token to the stream.
It returns an error if StartElement and EndElement tokens are not properly matched.
EncodeToken does not call Flush, because usually it is part of a larger operation
such as Encode or EncodeElement (or a custom Marshaler's MarshalXML invoked
during those), and those will call Flush when finished.
Callers that create an Encoder and then invoke EncodeToken directly, without
using Encode or EncodeElement, need to call Flush when finished to ensure
that the XML is written to the underlying writer.
EncodeToken allows writing a ProcInst with Target set to "xml" only as the first token
in the stream.
-
Flush
Receiver for *Encoder v1.0([])
Flush flushes any buffered XML to the underlying writer.
See the EncodeToken documentation for details about when it is necessary.
-
Indent
Receiver for *Encoder v1.0([prefix indent])
Indent sets the encoder to generate XML in which each element
begins on a new indented line that starts with prefix and is followed by
one or more copies of indent according to the nesting depth.
-
*EndElement
Concrete Type v1.0An EndElement represents an XML end element.
-
*Name
Concrete Type v1.0A Name represents an XML name (Local) annotated
with a name space identifier (Space).
In tokens returned by Decoder.Token, the Space identifier
is given as a canonical URL, not the short prefix used
in the document being parsed.
-
*ProcInst
Concrete Type v1.0A ProcInst represents an XML processing instruction of the form <?target inst?>
-
*StartElement
Concrete Type v1.0A StartElement represents an XML start element.
-
*SyntaxError
Concrete Type v1.0A SyntaxError represents a syntax error in the XML input stream.
-
Error
Receiver for *SyntaxError v1.0([])
-
*TagPathError
Concrete Type v1.0A TagPathError represents an error in the unmarshaling process
caused by the use of field tags with conflicting paths.
-
Error
Receiver for *TagPathError v1.0([])
-
*UnmarshalError
Concrete Type v1.0An UnmarshalError represents an error in the unmarshaling process.
-
*UnsupportedTypeError
Concrete Type v1.0UnsupportedTypeError is returned when Marshal encounters a type
that cannot be converted into XML.
-
Error
Receiver for *UnsupportedTypeError v1.0([])
-
Attr
Concrete Type v1.0An Attr represents an attribute in an XML element (Name=Value).
-
CharData
Concrete Type v1.0A CharData represents XML character data (raw text),
in which XML escape sequences have been replaced by
the characters they represent.
-
Copy
Receiver for CharData v1.0([])
Copy creates a new copy of CharData.
-
Comment
Concrete Type v1.0A Comment represents an XML comment of the form <!--comment-->.
The bytes do not include the <!-- and --> comment markers.
-
Copy
Receiver for Comment v1.0([])
Copy creates a new copy of Comment.
-
Decoder
Concrete Type v1.0A Decoder represents an XML parser reading a particular input stream.
The parser assumes that its input is encoded in UTF-8.
-
Directive
Concrete Type v1.0A Directive represents an XML directive of the form <!text>.
The bytes do not include the <! and > markers.
-
Copy
Receiver for Directive v1.0([])
Copy creates a new copy of Directive.
-
Encoder
Concrete Type v1.0An Encoder writes XML data to an output stream.
-
EndElement
Concrete Type v1.0An EndElement represents an XML end element.
-
Marshaler
Abstract Type v1.0Marshaler is the interface implemented by objects that can marshal
themselves into valid XML elements.
MarshalXML encodes the receiver as zero or more XML elements.
By convention, arrays or slices are typically encoded as a sequence
of elements, one per entry.
Using start as the element tag is not required, but doing so
will enable Unmarshal to match the XML elements to the correct
struct field.
One common implementation strategy is to construct a separate
value with a layout corresponding to the desired XML and then
to encode it using e.EncodeElement.
Another common strategy is to use repeated calls to e.EncodeToken
to generate the XML output one token at a time.
The sequence of encoded tokens must make up zero or more valid
XML elements.
-
MarshalXML
Method for Marshaler v1.0([e start])
-
MarshalerAttr
Abstract Type v1.0MarshalerAttr is the interface implemented by objects that can marshal
themselves into valid XML attributes.
MarshalXMLAttr returns an XML attribute with the encoded value of the receiver.
Using name as the attribute name is not required, but doing so
will enable Unmarshal to match the attribute to the correct
struct field.
If MarshalXMLAttr returns the zero attribute Attr{}, no attribute
will be generated in the output.
MarshalXMLAttr is used only for struct fields with the
"attr" option in the field tag.
-
MarshalXMLAttr
Method for MarshalerAttr v1.0([name])
-
Name
Concrete Type v1.0A Name represents an XML name (Local) annotated
with a name space identifier (Space).
In tokens returned by Decoder.Token, the Space identifier
is given as a canonical URL, not the short prefix used
in the document being parsed.
-
ProcInst
Concrete Type v1.0A ProcInst represents an XML processing instruction of the form <?target inst?>
-
Copy
Receiver for ProcInst v1.0([])
Copy creates a new copy of ProcInst.
-
StartElement
Concrete Type v1.0A StartElement represents an XML start element.
-
Copy
Receiver for StartElement v1.0([])
Copy creates a new copy of StartElement.
-
End
Receiver for StartElement v1.0([])
End returns the corresponding XML end element.
-
SyntaxError
Concrete Type v1.0A SyntaxError represents a syntax error in the XML input stream.
-
TagPathError
Concrete Type v1.0A TagPathError represents an error in the unmarshaling process
caused by the use of field tags with conflicting paths.
-
Token
Abstract Type v1.0A Token is an interface holding one of the token types:
StartElement, EndElement, CharData, Comment, ProcInst, or Directive.
-
TokenReader
Abstract Type v1.0A TokenReader is anything that can decode a stream of XML tokens, including a
Decoder.
When Token encounters an error or end-of-file condition after successfully
reading a token, it returns the token. It may return the (non-nil) error from
the same call or return the error (and a nil token) from a subsequent call.
An instance of this general case is that a TokenReader returning a non-nil
token at the end of the token stream may return either io.EOF or a nil error.
The next Read should return nil, io.EOF.
Implementations of Token are discouraged from returning a nil token with a
nil error. Callers should treat a return of nil, nil as indicating that
nothing happened; in particular it does not indicate EOF.
-
Token
Method for TokenReader v1.0([])
-
UnmarshalError
Concrete Type v1.0An UnmarshalError represents an error in the unmarshaling process.
-
Error
Receiver for UnmarshalError v1.0([])
-
Unmarshaler
Abstract Type v1.0Unmarshaler is the interface implemented by objects that can unmarshal
an XML element description of themselves.
UnmarshalXML decodes a single XML element
beginning with the given start element.
If it returns an error, the outer call to Unmarshal stops and
returns that error.
UnmarshalXML must consume exactly one XML element.
One common implementation strategy is to unmarshal into
a separate value with a layout matching the expected XML
using d.DecodeElement, and then to copy the data from
that value into the receiver.
Another common strategy is to use d.Token to process the
XML object one token at a time.
UnmarshalXML may not use d.RawToken.
-
UnmarshalXML
Method for Unmarshaler v1.0([d start])
-
UnmarshalerAttr
Abstract Type v1.0UnmarshalerAttr is the interface implemented by objects that can unmarshal
an XML attribute description of themselves.
UnmarshalXMLAttr decodes a single XML attribute.
If it returns an error, the outer call to Unmarshal stops and
returns that error.
UnmarshalXMLAttr is used only for struct fields with the
"attr" option in the field tag.
-
UnmarshalXMLAttr
Method for UnmarshalerAttr v1.0([attr])
-
UnsupportedTypeError
Concrete Type v1.0UnsupportedTypeError is returned when Marshal encounters a type
that cannot be converted into XML.
-
arrayOfAttr
Concrete Type v1.0An Attr represents an attribute in an XML element (Name=Value).
-
arrayOfCharData
Concrete Type v1.0A CharData represents XML character data (raw text),
in which XML escape sequences have been replaced by
the characters they represent.
-
arrayOfComment
Concrete Type v1.0A Comment represents an XML comment of the form <!--comment-->.
The bytes do not include the <!-- and --> comment markers.
-
arrayOfDecoder
Concrete Type v1.0A Decoder represents an XML parser reading a particular input stream.
The parser assumes that its input is encoded in UTF-8.
-
arrayOfDirective
Concrete Type v1.0A Directive represents an XML directive of the form <!text>.
The bytes do not include the <! and > markers.
-
arrayOfEncoder
Concrete Type v1.0An Encoder writes XML data to an output stream.
-
arrayOfEndElement
Concrete Type v1.0An EndElement represents an XML end element.
-
arrayOfMarshaler
Concrete Type v1.0Marshaler is the interface implemented by objects that can marshal
themselves into valid XML elements.
MarshalXML encodes the receiver as zero or more XML elements.
By convention, arrays or slices are typically encoded as a sequence
of elements, one per entry.
Using start as the element tag is not required, but doing so
will enable Unmarshal to match the XML elements to the correct
struct field.
One common implementation strategy is to construct a separate
value with a layout corresponding to the desired XML and then
to encode it using e.EncodeElement.
Another common strategy is to use repeated calls to e.EncodeToken
to generate the XML output one token at a time.
The sequence of encoded tokens must make up zero or more valid
XML elements.
-
arrayOfMarshalerAttr
Concrete Type v1.0MarshalerAttr is the interface implemented by objects that can marshal
themselves into valid XML attributes.
MarshalXMLAttr returns an XML attribute with the encoded value of the receiver.
Using name as the attribute name is not required, but doing so
will enable Unmarshal to match the attribute to the correct
struct field.
If MarshalXMLAttr returns the zero attribute Attr{}, no attribute
will be generated in the output.
MarshalXMLAttr is used only for struct fields with the
"attr" option in the field tag.
-
arrayOfName
Concrete Type v1.0A Name represents an XML name (Local) annotated
with a name space identifier (Space).
In tokens returned by Decoder.Token, the Space identifier
is given as a canonical URL, not the short prefix used
in the document being parsed.
-
arrayOfProcInst
Concrete Type v1.0A ProcInst represents an XML processing instruction of the form <?target inst?>
-
arrayOfStartElement
Concrete Type v1.0A StartElement represents an XML start element.
-
arrayOfSyntaxError
Concrete Type v1.0A SyntaxError represents a syntax error in the XML input stream.
-
arrayOfTagPathError
Concrete Type v1.0A TagPathError represents an error in the unmarshaling process
caused by the use of field tags with conflicting paths.
-
arrayOfToken
Concrete Type v1.0A Token is an interface holding one of the token types:
StartElement, EndElement, CharData, Comment, ProcInst, or Directive.
-
arrayOfTokenReader
Concrete Type v1.0A TokenReader is anything that can decode a stream of XML tokens, including a
Decoder.
When Token encounters an error or end-of-file condition after successfully
reading a token, it returns the token. It may return the (non-nil) error from
the same call or return the error (and a nil token) from a subsequent call.
An instance of this general case is that a TokenReader returning a non-nil
token at the end of the token stream may return either io.EOF or a nil error.
The next Read should return nil, io.EOF.
Implementations of Token are discouraged from returning a nil token with a
nil error. Callers should treat a return of nil, nil as indicating that
nothing happened; in particular it does not indicate EOF.
-
arrayOfUnmarshalError
Concrete Type v1.0An UnmarshalError represents an error in the unmarshaling process.
-
arrayOfUnmarshaler
Concrete Type v1.0Unmarshaler is the interface implemented by objects that can unmarshal
an XML element description of themselves.
UnmarshalXML decodes a single XML element
beginning with the given start element.
If it returns an error, the outer call to Unmarshal stops and
returns that error.
UnmarshalXML must consume exactly one XML element.
One common implementation strategy is to unmarshal into
a separate value with a layout matching the expected XML
using d.DecodeElement, and then to copy the data from
that value into the receiver.
Another common strategy is to use d.Token to process the
XML object one token at a time.
UnmarshalXML may not use d.RawToken.
-
arrayOfUnmarshalerAttr
Concrete Type v1.0UnmarshalerAttr is the interface implemented by objects that can unmarshal
an XML attribute description of themselves.
UnmarshalXMLAttr decodes a single XML attribute.
If it returns an error, the outer call to Unmarshal stops and
returns that error.
UnmarshalXMLAttr is used only for struct fields with the
"attr" option in the field tag.
-
arrayOfUnsupportedTypeError
Concrete Type v1.0UnsupportedTypeError is returned when Marshal encounters a type
that cannot be converted into XML.