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.
(v any)
| 167 | // |
| 168 | // Encode calls Flush before returning. |
| 169 | func (enc *Encoder) Encode(v any) error { |
| 170 | err := enc.p.marshalValue(reflect.ValueOf(v), nil, nil) |
| 171 | if err != nil { |
| 172 | return err |
| 173 | } |
| 174 | return enc.p.w.Flush() |
| 175 | } |
| 176 | |
| 177 | // EncodeElement writes the XML encoding of v to the stream, |
| 178 | // using start as the outermost tag in the encoding. |
no test coverage detected