summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2020-01-29 21:01:49 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2020-01-29 21:01:49 -0500
commit65a401ccf7dd37474868e122393db8bee7ce3c4d (patch)
tree917cdc83b909343ca408fb82ba1496466a1f1a2d
parent036f7ab20b7bdcddcdbac4071e359602b1a0728f (diff)
wip
-rw-r--r--rrdformat/marshal_xml.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/rrdformat/marshal_xml.go b/rrdformat/marshal_xml.go
index 7263810..d81c6cc 100644
--- a/rrdformat/marshal_xml.go
+++ b/rrdformat/marshal_xml.go
@@ -8,7 +8,7 @@ import (
//const XMLNS = "https://oss.oetiker.ch/rrdtool/rrdtool-dump.xml"
func (rrd RRD) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
- return e.Encode(rrd.Data)
+ return e.EncodeElement(rrd.Data, start)
}
func xmlStart(name string) xml.StartElement {
@@ -34,15 +34,18 @@ func (rrd RRDv0005) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if err := e.Encode(rrd.Header); err != nil {
return err
}
- // 2
- if err := e.Encode(rrd.LastUpdated); err != nil {
+ // 2. Last Updated
+ if err := e.EncodeElement(rrd.LastUpdated, xmlStart("lastupdate")); err != nil {
return err
}
+
if err := e.EncodeToken(xml.CharData("\n")); err != nil {
return err
}
+
+ // 3. Data Sources
for _, ds := range rrd.DSDefs {
- if err := e.Encode(ds); err != nil {
+ if err := e.EncodeElement(ds, xmlStart("ds")); err != nil {
return err
}
}
@@ -54,7 +57,7 @@ func (rrd RRDv0005) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
}
func (t TimeWithUsec) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
- return TimeWithoutUsec{Sec: t.Sec}.MarshalXML(e, start)
+ return e.EncodeElement(TimeWithoutUsec{Sec: t.Sec}, start)
}
func (t TimeWithoutUsec) MarshalXML(e *xml.Encoder, start xml.StartElement) error {