summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 {