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

Method WriteTo

etree.go:445–453  ·  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

443// WriteTo serializes the document out to the writer 'w'. The function returns
444// the number of bytes written and any error encountered.
445func (d *Document) WriteTo(w io.Writer) (n int64, err error) {
446 xw := newXmlWriter(w)
447 b := bufio.NewWriter(xw)
448 for _, c := range d.Child {
449 c.WriteTo(b, &d.WriteSettings)
450 }
451 err, n = b.Flush(), xw.bytes
452 return
453}
454
455// WriteToFile serializes the document out to the file at path 'filepath'.
456func (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