MCPcopy Create free account
hub / github.com/beevik/etree / WriteTo

Method WriteTo

etree.go:439–447  ·  view source on GitHub ↗

WriteTo serializes the document out to the writer 'w'. The function returns the number of bytes written and any error encountered.

(w io.Writer)

Source from the content-addressed store, hash-verified

437// WriteTo serializes the document out to the writer 'w'. The function returns
438// the number of bytes written and any error encountered.
439func (d *Document) WriteTo(w io.Writer) (n int64, err error) {
440 xw := newXmlWriter(w)
441 b := bufio.NewWriter(xw)
442 for _, c := range d.Child {
443 c.WriteTo(b, &d.WriteSettings)
444 }
445 err, n = b.Flush(), xw.bytes
446 return
447}
448
449// WriteToFile serializes the document out to the file at path 'filepath'.
450func (d *Document) WriteToFile(filepath string) error {

Callers 3

ExampleDocument_creatingFunction · 0.95
WriteToFileMethod · 0.95
WriteToBytesMethod · 0.95

Calls 2

newXmlWriterFunction · 0.85
WriteToMethod · 0.65

Tested by 1

ExampleDocument_creatingFunction · 0.76