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)
| 165 | // |
| 166 | // EncodeElement calls Flush before returning. |
| 167 | func (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 | |
| 175 | var ( |
| 176 | begComment = []byte("<!--") |