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

Function FetchRootElement

encoding/xml/xml_decoder.go:143–154  ·  view source on GitHub ↗

FetchRootElement takes in a decoder and returns the first start element within the xml body. This function is useful in fetching the start element of an XML response and ignore the comments and preamble

(decoder *xml.Decoder)

Source from the content-addressed store, hash-verified

141// This function is useful in fetching the start element of an XML response and ignore the
142// comments and preamble
143func FetchRootElement(decoder *xml.Decoder) (startElement xml.StartElement, err error) {
144 for {
145 t, e := decoder.Token()
146 if e != nil {
147 return startElement, e
148 }
149
150 if startElement, ok := t.(xml.StartElement); ok {
151 return startElement, err
152 }
153 }
154}

Callers 4

TestXMLNodeDecoder_TokenFunction · 0.85
TestXMLNodeDecoder_ValueFunction · 0.85
Test_FetchXMLRootElementFunction · 0.85

Calls 1

TokenMethod · 0.80

Tested by 4

TestXMLNodeDecoder_TokenFunction · 0.68
TestXMLNodeDecoder_ValueFunction · 0.68
Test_FetchXMLRootElementFunction · 0.68