package search import ( "encoding/xml" "testing" xsd "github.com/use-go/onvif/xsd" ) func TestMarshallSummary(t *testing.T) { summary := RecordingSummary{ DataFrom: xsd.DateTime("2019-01-01T00:00:00Z"), DataUntil: xsd.DateTime("2019-01-01T00:00:00Z"), NumberRecordings: xsd.Int(1), } b, err := xml.Marshal(summary) if err != nil { t.Fatal(err) } t.Log(string(b)) } func TestUnmarshallSummary(t *testing.T) { data := ` 2024-10-16T01:03:32Z 2024-10-30T09:41:47Z 1 ` type Envelope struct { Header struct{} Body struct { GetRecordingSummaryResponse GetRecordingSummaryResponse } } var reply Envelope // var reply GetRecordingSummaryResponse err := xml.Unmarshal([]byte(data), &reply) if err != nil { t.Fatal(err) } t.Log(reply) }