draw2d/draw2dsvg/fileutil.go

22 lines
327 B
Go
Raw Normal View History

package draw2dsvg
import (
"os"
2017-12-21 17:18:29 +00:00
"encoding/xml"
2017-12-21 14:52:26 +00:00
_ "errors"
)
2017-12-21 17:18:29 +00:00
func SaveToSvgFile(filePath string, svg *Svg) error {
f, err := os.Create(filePath)
if err != nil {
return err
}
defer f.Close()
2017-12-21 17:18:29 +00:00
f.Write([]byte(xml.Header))
encoder := xml.NewEncoder(f)
encoder.Indent("", "\t")
err = encoder.Encode(svg)
2017-12-21 17:18:29 +00:00
return err
}