MCPcopy
hub / github.com/AlistGo/alist / DecodeElement

Method DecodeElement

server/webdav/internal/xml/read.go:127–133  ·  view source on GitHub ↗

DecodeElement works like xml.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.

(v interface{}, start *StartElement)

Source from the content-addressed store, hash-verified

125// It is useful when a client reads some raw XML tokens itself
126// but also wants to defer to Unmarshal for some elements.
127func (d *Decoder) DecodeElement(v interface{}, start *StartElement) error {
128 val := reflect.ValueOf(v)
129 if val.Kind() != reflect.Ptr {
130 return errors.New("non-pointer passed to Unmarshal")
131 }
132 return d.unmarshal(val.Elem(), start)
133}
134
135// An UnmarshalError represents an error in the unmarshalling process.
136type UnmarshalError string

Callers 3

parseXMLFunction · 0.95
DecodeMethod · 0.95
UnmarshalXMLMethod · 0.80

Calls 1

unmarshalMethod · 0.95

Tested by

no test coverage detected