package producer import ( "encoding/xml" "os" ) // Report represents the root XML element type Report struct { XMLName xml.Name `xml:"report"` Satellite string `xml:"satellite,attr"` Sensor string `xml:"sensor,attr"` ProductLevel string `xml:"productLevel,attr"` Scenes []ReportScene `xml:"scenes>scene"` } // Scene represents each scene in the report type ReportScene struct { Name string `xml:"name,attr"` TiffData string `xml:"tiffData"` TfwData string `xml:"tfwData,omitempty"` RpbData string `xml:"rpbData,omitempty"` BrowserData string `xml:"browserData,omitempty"` BrowserRpbData string `xml:"browserRpbData,omitempty"` ThumbData string `xml:"thumbData,omitempty"` ShpData string `xml:"shpData,omitempty"` ShxData string `xml:"shxData,omitempty"` DbfData string `xml:"dbfData,omitempty"` MetaData string `xml:"metaData"` QualityData string `xml:"qualityData,omitempty"` } func WriteReport(report *Report, filename string) error { output, err := xml.MarshalIndent(report, "", " ") if err != nil { return err } err = os.WriteFile(filename, output, 0644) if err != nil { return err } return nil }