draw2d/draw2dsvg/fileutil.go
2017-12-21 18:18:29 +01:00

22 lines
No EOL
327 B
Go

package draw2dsvg
import (
"os"
"encoding/xml"
_ "errors"
)
func SaveToSvgFile(filePath string, svg *Svg) error {
f, err := os.Create(filePath)
if err != nil {
return err
}
defer f.Close()
f.Write([]byte(xml.Header))
encoder := xml.NewEncoder(f)
encoder.Indent("", "\t")
err = encoder.Encode(svg)
return err
}