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

Method EncodeElement

server/webdav/internal/xml/marshal.go:167–173  ·  view source on GitHub ↗

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.

(v interface{}, start StartElement)

Source from the content-addressed store, hash-verified

165//
166// EncodeElement calls Flush before returning.
167func (enc *Encoder) EncodeElement(v interface{}, start StartElement) error {
168 err := enc.p.marshalValue(reflect.ValueOf(v), nil, &start)
169 if err != nil {
170 return err
171 }
172 return enc.p.Flush()
173}
174
175var (
176 begComment = []byte("<!--")

Callers 2

TestEncodeElementFunction · 0.95
MarshalXMLMethod · 0.80

Calls 2

marshalValueMethod · 0.80
FlushMethod · 0.45

Tested by 1

TestEncodeElementFunction · 0.76