MCPcopy Create free account
hub / github.com/aws/smithy-go / Token

Method Token

encoding/xml/xml_decoder.go:28–47  ·  view source on GitHub ↗

Token on a Node Decoder returns a xml StartElement. It returns a boolean that indicates the a token is the node decoder's end node token; and an error which indicates any error that occurred while retrieving the start element

()

Source from the content-addressed store, hash-verified

26// a token is the node decoder's end node token; and an error which indicates any error
27// that occurred while retrieving the start element
28func (d NodeDecoder) Token() (t xml.StartElement, done bool, err error) {
29 for {
30 token, e := d.Decoder.Token()
31 if e != nil {
32 return t, done, e
33 }
34
35 // check if we reach end of the node being decoded
36 if el, ok := token.(xml.EndElement); ok {
37 return t, el == d.StartEl.End(), err
38 }
39
40 if t, ok := token.(xml.StartElement); ok {
41 return restoreAttrNamespaces(t), false, err
42 }
43
44 // skip token if it is a comment or preamble or empty space value due to indentation
45 // or if it's a value and is not expected
46 }
47}
48
49// restoreAttrNamespaces update XML attributes to restore the short namespaces found within
50// the raw XML document.

Callers 8

GetElementMethod · 0.95
TestXMLNodeDecoder_TokenFunction · 0.80
ValueMethod · 0.80
FetchRootElementFunction · 0.80
DiscardUnknownFieldFunction · 0.80
collectUnknownFieldFunction · 0.80
XMLToStructFunction · 0.80

Calls 2

restoreAttrNamespacesFunction · 0.85
EndMethod · 0.65

Tested by 2

TestXMLNodeDecoder_TokenFunction · 0.64